How do i set a datetime-local value to mm/dd/yyyy --:-- AM/PM automatically? I don't know how to start and i've been search since yesterday on how to do it.
Asked
Active
Viewed 1,941 times
0
-
duplicate of http://stackoverflow.com/questions/8888491/how-do-you-display-javascript-datetime-in-12-hour-am-pm-format – Vinod Louis Nov 25 '16 at 11:16
3 Answers
2
I suggest you to use momentjs(http://momentjs.com/) for date formatting
moment().format('MM/DD/YYYY hh:mm A');

maheshiv
- 1,778
- 2
- 17
- 21
2
Visit this link for reference http://www.w3schools.com/js/js_dates.asp
Hope it helps!

mentosp09
- 123
- 1
- 2
- 11
2
Get a local time using:
var now = new Date();
convert local time into UTC format:
var UTCFormat = now.toUTCString();
you can go here to read more about conversions.

marquesm91
- 535
- 6
- 23