Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
21
rated 0 times [  24] [ 3]  / answers: 1 / hits: 46632  / 15 Years ago, sat, december 19, 2009, 12:00:00

I'm looking for a way to convert a Javascript Date object to a string. I'm converting my site from Ruby to server side Javascript, and I'm looking for something analogous to strftime in Ruby, C, and many other languages.



I found plenty of simple scripts that do this kind of conversion, but I'd prefer not to include a custom implementation if there is a standard way of doing this.



I'm not using a Javascript framework. I'm using Mozilla Rhino, but would prefer to stay away from using the Java library as much as possible, to allow moving my code easily between implementations.



I want to be able to specify the format of the string, since I want to embed it in a sentence. I want to be able to insert arbitrary on's and at's, and have the full name of the day, not just it's abbreviation. So toString() won't suffice.


More From » datetime

 Answers
12

MomentJS has a very robust set of time formatting options, and has also been updated recently.


[#98033] Wednesday, December 16, 2009, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
khalilb

Total Points: 173
Total Questions: 110
Total Answers: 105

Location: Honduras
Member since Thu, Mar 23, 2023
1 Year ago
;