Convert Java Date String to JavaScript Date

Is there any JavaScript library that accepts a Java SimpleDateFormat pattern and parses a date / time string in a Date object?

For example, when using "2010-12-20" and "yyyy-MM-dd" function will parse "2010-12-20" and return a JavaScript Date .

I noticed that jQuery UI Date Picker can format and parse a date string, but it does not work with a time string.

Thanks.

+4
source share
4 answers
+1
source

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

+1
source

I think you're not the only one looking for him. See this thread , which has similar content. In the end, the author had to play a role, but there are good suggestions that can be of use.

0
source

There is a class for this in the Google GWT project. http://google-web-toolkit.googlecode.com/svn/javadoc/1.5/com/google/gwt/i18n/client/DateTimeFormat.html This is probably a little work to get this in stand-alone javascript.

0
source

Source: https://habr.com/ru/post/1336626/


All Articles