Pretty-printing a datetime as a day of the week plus time in jQuery/JavaScript
I'm looking for a (ideally jQuery plugin) Javascript library that will let me provide datetimes formatted in whatever standard format (ISO 8601 seems to be the most commonly used among libraries that do something similar, like timeago and Prettydate), and have them transformed into strings like:
- Wednesday, 5:00pm
- Tomorrow, 9:00am
- Saturday, 11:00pm
etc.
Timezone offsets are not a concern, since the event entities (the time of which I want to pretty print like above) are only s开发者_StackOverflow社区hown to a user if they are sufficiently geographically close (within a single timezone).
Any ideas? Any and all help is appreciated! :)
Take a look at Datejs
Datejs is an open-source JavaScript Date Library.
Comprehensive, yet simple, stealthy and fast. Datejs has passed all trials and is ready to strike. Datejs doesn’t just parse strings, it slices them cleanly in two.
The API is clean and easy to understand, and it just works.
精彩评论