I\'m working with a script that displays the date and time in ISO 8601 format like so: 2012-05-17T17:35:44.000Z
.
but I would like it to display in the n
I think this is a more complete solution and elegant solution :
// time formats have 2 ways of showing themselves: 1994-11-05T13:15:30Z UTC format OR 1994-11-05T08:15:30-05:00
local.initial_date = parseDateTime(REReplace(ISODateString, "(\d{4})-?(\d{2})-?(\d{2})T([\d:]+).*", "\1-\2-\3 \4"));
// If not in UTC format then we need to
if (right(arguments.ISODateString, 1) neq "Z") {
local.timeModifier = "";
//Now we determine if we are adding or deleting the the time modifier.
if (ISODateString contains '+' and listlen(listrest(ISODateString,"+"),":") eq 2){
local.timeModifier = listrest(ISODateString,"+");
local.multiplier = 1; // Add
} else if (listlen(listlast(ISODateString,"-"),":") eq 2) {
local.timeModifier = listlast(ISODateString,"-");
local.multiplier = -1; // Delete
}
if (len(local.timeModifier)){
local.initial_date = dateAdd("h", val(listfirst(local.timeModifier,":"))*local.multiplier,local.initial_date);
local.initial_date = dateAdd("m", val(listlast(local.timeModifier,":"))*local.multiplier,local.initial_date);
}
}
return local.initial_date;