cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

Error parseDate - Invalid format: "1488722317000" is malformed at "7000"

aelgov
1-Newbie

Error parseDate - Invalid format: "1488722317000" is malformed at "7000"

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

1 REPLY 1
ankigupta
5-Regular Member
(To:aelgov)

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

Top Tags