Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X
Hi,
I don't know what went wrong but I'm trying to do something very simple.
I have infotable with DateTime column, I want to run over it and parse the date.
I get an error for the following code:
var tableLength = result.rows.length;
for (var x = 0; x < tableLength; x++) {
var row = result.rows
//"yyyy-MM-dd HH:mm:ss.SSS";
var dateFormat = Resources["RuntimeLocalizationFunctions"].GetEffectiveToken({token: "dateTimeFormat"});
var dateValue = parseDate(row.DateTime, dateFormat);
}
I also tried to do toString to row.DateTime and it didn't work
Hi Assaf Elgov,
Please try using the ThingWorx inbuilt function dateFormat.
// dateValue:DATETIME
var dateValue = new Date();
// dateFormat(dateValue:DATETIME,dateFormat:STRING):STRING
var formattedDate = dateFormat(dateValue, "yyyy-MM-dd HH:mm:ss.SSS");
It worked fine for me.
Do let me know if you still face any issue.
Thanks,
Ankit Gupta