Is there a working jQuery plugin (or a javascript 'library') for formatting datetimes? I found some, but they were:
- not working with hours and minutes (the one from datapicker)
- not fully functional - can't give you names of months, leading zeroes开发者_StackOverflow中文版, etc.
- are just a piece of code written in some blog.
Of course I can implement it, but it'd be better to reuse one. I seek functionality similar to Java's SimpleDateFormat
I've written a JavaScript implementation of the format()
method of Java's SimpleDateFormat
: http://www.timdown.co.uk/code/simpledateformat.php
The code is a few years old and I'd do it a bit differently now, but it's well tested and works.
Did you try date.js ?
It has a pattern recognition to format dates that is easy to use and has plenty of localisation files available.
ie: Date.today().toString("d-MMM-yyyy HH:mm")
I use http://blog.stevenlevithan.com/archives/date-time-format
Not sure whether it fits all your requirements, but this looks good one:
- jquery-dateFormat
精彩评论