2008-04-30
js时间格式转换
关键字: jsJavaScript时间格式转换总结
1.当前系统区域设置格式(toLocaleDateString和toLocaleTimeString)
例子:(new Date()).toLocaleDateString() + " " + (new Date()).toLocaleTimeString()
结果: 2008年1月29日 16:13:11
2.普通字符串(toDateString和toTimeString)
例子: (new Date()).toDateString() + " " + (new Date()).toTimeString()
结果:Tue Jan 29 2008 16:13:11 UTC+0800
3.格林威治标准时间(toGMTString)
例子: (new Date()).toGMTString()
结果:Tue, 29 Jan 2008 08:13:11 UTC
4.全球标准时间(toUTCString)
例子: (new Date()).toUTCString()
结果:Tue, 29 Jan 2008 08:13:11 UTC
5.Date对象字符串(toString)
例子: (new Date()).toString()
结果:Tue Jan 29 16:13:11 UTC+0800 2008
例子:(new Date()).toLocaleDateString() + " " + (new Date()).toLocaleTimeString()
结果: 2008年1月29日 16:13:11
2.普通字符串(toDateString和toTimeString)
例子: (new Date()).toDateString() + " " + (new Date()).toTimeString()
结果:Tue Jan 29 2008 16:13:11 UTC+0800
3.格林威治标准时间(toGMTString)
例子: (new Date()).toGMTString()
结果:Tue, 29 Jan 2008 08:13:11 UTC
4.全球标准时间(toUTCString)
例子: (new Date()).toUTCString()
结果:Tue, 29 Jan 2008 08:13:11 UTC
5.Date对象字符串(toString)
例子: (new Date()).toString()
结果:Tue Jan 29 16:13:11 UTC+0800 2008
发表评论
- 浏览: 1616 次
- 性别:

- 来自: 郑州

- 详细资料
搜索本博客
最新评论
-
Dwr2+Struts2+Spring2.5+H ...
jackzhangyunjie 写道回复power_zl: 我看了你出现的错 ...
-- by power_zl -
Dwr2+Struts2+Spring2.5+H ...
回复power_zl: 我看了你出现的错误,这种错误一般情况下是因为你没有此 ...
-- by jackzhangyunjie -
Dwr2+Struts2+Spring2.5+H ...
严重: Context initialization failedorg.spr ...
-- by power_zl -
电子地图--MapABC研究( ...
呵呵,lz太言重了,我也是开玩笑而已。他们开放只是他们采集的城市基础数据,至于应 ...
-- by transist -
Dwr2+Struts2+Spring2.5+H ...
commons-fileupload-1.2.1.jar 这个可以不要吧!
-- by lijie250






评论排行榜