I am writing a script for automating XML data in Indesign. I currently have in the XML the date in American Format (MM/D/YY) but once I run the script in Indesign my goal is to have it be in European format (DD/M/YY). What can I add to my script in order to write a function that will convert any date formats to european formats? I hope this makes sense. I need help!
i guess simply using
function convertDate(dateString) {
var date = new Date(dateString);
return date.getDate()+"/"+(date.getMonth() + 1)+"/"+date.getFullYear();
}
just note european format does not use slashes but dots as far as i know so it should look like this dd.mm.yyyy not dd/mm/yyyy becouse it can be mismatched with us format
var myDate = new Date('myDateString'); //you can also do milliseconds instead of the date string
var myEuroDate = myDate.getDate() + '/' + myDate.getMonth + '/' + myDate.getFullYear();
Useful as well... http://arshaw.com/xdate/
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.