最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Converting Java date string to JavaScript date - Stack Overflow

programmeradmin0浏览0评论

Is there any JavaScript library that takes Java's SimpleDateFormat pattern and parses a date/time string into a Date object?

For example, given "2010-12-20" and "yyyy-MM-dd", the function would parse "2010-12-20" and return a JavaScript Date.

I noticed that jQuery UI's Date Picker can format and parse a date string, but it doesn't work with a time string.

Thanks.

Is there any JavaScript library that takes Java's SimpleDateFormat pattern and parses a date/time string into a Date object?

For example, given "2010-12-20" and "yyyy-MM-dd", the function would parse "2010-12-20" and return a JavaScript Date.

I noticed that jQuery UI's Date Picker can format and parse a date string, but it doesn't work with a time string.

Thanks.

Share Improve this question edited Jan 23, 2011 at 0:00 Tom Tucker asked Jan 22, 2011 at 20:44 Tom TuckerTom Tucker 11.9k23 gold badges95 silver badges132 bronze badges 0
Add a ment  | 

4 Answers 4

Reset to default 1

This might be what you want: http://www.timdown.co.uk/code/simpledateformat.php

I would try the Datejs library: http://www.datejs./

I guess you are not the only looking for it. See this thread that has similar content. In the end, the author had to role his/her own but there are some good suggestions in there that might be of benefit.

Google's GWT project has a class to do this. http://google-web-toolkit.googlecode./svn/javadoc/1.5//google/gwt/i18n/client/DateTimeFormat.html Probably no small job to get that into a standalone javascript, though.

发布评论

评论列表(0)

  1. 暂无评论