简体   繁体   中英

Set Datetime order in JavaScript

Is there any way of manipulate datetime in JavaScript?? I mean, I would like to get a datetime and change to this format ('DD/MM/YYYY hh:mm A/PM').

This is my code

$('#control_day_edit').val(calEvent.start._i)

This returns me this: 01/07/2015 05:11 PM But I need it returns me this: 07/01/2015 05:11 PM

JavaScript has virtually no built-in date/time formatting. Instead, you either use the individual methods of Date instances ( getHours , getMinutes , etc.) to build your string, or use a library like MomentJS which uses them for you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM