Possible Duplicate:
Formatting a date in javascript
I know other possible formats in JavaScript Date object but I did not get on how to format the date to MM/dd/yyyy HH:mm:ss format.
Please let me know if you come across such problem.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
[Addendum 12/2022]: Here’s a library to format dates using
Intl.DateTimeFormat.[Addendum 01/2024]: And here is a (ES-)Date manipulation library
Try something like this
If you want leading zero’s for values < 10, use this number extension
Applied to the previous code:
See this code in [jsfiddle][1]
[edit 2019] Using ES20xx, you can use a template literal and the new
padStartstring extension.