构造一个当前时间,使用yyyy/mm/dd hh:mm:ss的格式显示出来?

慕标8001392
浏览 2973回答 3
3回答

慕数据8267187

ONWCEADRBLEUOUTZGGFXXCDKPOYVEOXWYSBLKMRJHAIOHHBOUCYBXAQGTQPWLDEHRKHUOEEEDFWLDNGEARBSNZOXHRTKGVCLPRUNAZWXTDHXYHDDXNZMJIZTAZVEUUQDJZTWCRBKRYVGJNNQMEYEHXTMSCMFQSHOXEGWHEHOVNRQBQVDGZQTRGSZIMSSFQNYRQZFFGSLPPZFSAAPPQQIHLLIVUESMTSGWGQJENTSSIHOBYHHGODTJCYBRIGMQOBHHXOXBBYEYXZBLRHXKUDNJLEVLVCZMDULTSOYYULKXUOPPEOFNZMWIMNNBPEORNERYLYYNDWNJZEYBRHXQYCZMZJSEBUQGBXHOULFERZYTICVVDGDPZPZQZPHBNSNCIFRTSOETANHWGWPWLNNTLINMCYIPOODDWWCIEHXGPLUUYODMSYIQFBIRYUXQYOKPYURBCLVKEKNZOSILVLRLKXAWLVOSBWFLCFVLDUUROEUKVIIAPLLHYLBHAKLCGTJKNIOKAAQIMIBBOERYYHBSKGMMZFFIOLOHPTINGMLVBRUVNTTJSYOUHHMEPVRHOKQQNJBWOREVBURKZIDLCYKHTGMWMISXWBLJPBEYEKNBFKDEEOLVLKUPXLPMIVBOEAUTYXDYEEHXDZJEGWQRXKLVROMMRWAQNACCNJXIAGGNTQDDDZNQTYSCDKDVWCGBTENNDCDQBUHYQMMHNMQQDGJFIPLVHNHNQWAKCTZXIEPYYVOASOHAKMZMUHNNFBLLSVBVBZJEBXKLIUFBSYNNBXNDGVRHQNJIXZIYOETXGGLJZOENWZBLOKTCDHKHXGCSVQYWKNPSPRNDZCSIXTWMILIQSIKQMUXHVEHXAWZHCFPFVEACSPXQEBXBMOYOKUCQSUDGQLOYHQGNCTPSBXOPGWLNQFVSVQTOYHKMNPSBENDGOEHMUQMDGCRGXAEPEGUENJZIEUP

熊熊不咆哮

JavaScript获取时间后以指定格式输出一般就是用Date对象的api分别获取部分,然后拼接起来。第二种方法就是下面这个了。 var d = new Date(); new Date(d.getTime() - d.getTimezoneOffset() * 60000).toISOString().replace("T", " ").replace(/\..+$/,"");

慕标8001392

var times = new Date();time = now.getFullYear()+"/"+((now.getMonth()+1)<10?"0":"")+(now.getMonth()+1)+"/"+(now.getDate()<10?"0":"")+now.getDate()+" "+now.getHours()+":"+now.getMinutes()+":"+now.getSeconds();alert(times);alert(time);

慕神0244720

var now = new Date(); time = now.getFullYear()+"/"+((now.getMonth()+1)<10?"0":"")+(now.getMonth()+1)+"/"+(now.getDate()<10?"0":"")+now.getDate()+" "+now.getHours()+":"+now.getMinutes()+":"+now.getSeconds();这是用javaScript实现的。

Gotta

Date对象了解一下
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript