jquery函数转换日期时间,分割日期时间“2010-10-18 10:06”返回“18/10/2010”和“10:06” [英] jquery function to convert datetime, split date time "2010-10-18 10:06" to return "18/10/2010" and "10:06"

查看:141
本文介绍了jquery函数转换日期时间,分割日期时间“2010-10-18 10:06”返回“18/10/2010”和“10:06”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有任何jquery功能可以采用这个dateTime2010-10-18 10:06,并转换并分割返回2010/10/18和10:06。



如果相同的功能可以接收2010-10-18 10:06或2010-10-18,并返回如上所述也会很好,或除2010/10/18(如2010年10月18日)或2010年10月18日之外的不同格式,给出选项但不重要,只是对处理日期的jQuery权力感到好奇。



谢谢。

解决方案

使用 DateJs 应该很简单:

  var d1 = Date.parse('2010-10-18,10:06 AM'); 
alert(d1.toString('dd / mm / yyyy HH:mm:ss GMT' ));

它是目前最好的图书馆


Hi I was wondering if there is any jquery function around which can take this dateTime "2010-10-18 10:06" and convert and split it returning "2010/10/18" and "10:06".

It would be also nice if the same function could either receive "2010-10-18 10:06" or "2010-10-18" only and return as mentioned above, or different formats besides "2010/10/18" like 18-10-2010" or and 18th of October 2010, giving the option but not that important, just curious about jQuery power dealing with dates.

Thanks.

解决方案

Converting with DateJs should be as easy as:

var d1 = Date.parse('2010-10-18, 10:06 AM');
alert(d1.toString('dd/mm/yyyy HH:mm:ss GMT'));

It's currently the best library around

这篇关于jquery函数转换日期时间,分割日期时间“2010-10-18 10:06”返回“18/10/2010”和“10:06”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆