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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

Is it possible to format date with milliseconds in TWX?

aelgov
1-Visitor

Is it possible to format date with milliseconds in TWX?

Hi,

I tried many options - none works, is there any quick way without parsing it manually?

DateString = "2017-02-20 15:04:39.543"

Option 1:

var sdf = "yyyy-MM-dd HH:mm:ss.sss";

var dateValue = parseDate(DateString, sdf);

Option 2:

var sdf = "yyyy-MM-dd HH:mm:ss.fff";

var dateValue = parseDate(DateString, sdf);

Option 3:

var sdf = "yyyy-MM-dd HH:mm:ss.fffZ";

var dateValue = parseDate(DateString, sdf);

Option 4:

var msec = Date.parse(DateString);

var dateValue = new Date(msec);

ACCEPTED SOLUTION

Accepted Solutions
qngo
12-Amethyst
(To:aelgov)

It's almost option 1:

var sdf = "yyyy-MM-dd HH:mm:ss.SSS";

View solution in original post

3 REPLIES 3
qngo
12-Amethyst
(To:aelgov)

It's almost option 1:

var sdf = "yyyy-MM-dd HH:mm:ss.SSS";

aelgov
1-Visitor
(To:qngo)

Thank you very much!!!

Works like a charm...

I just wonder where exactly is it stated to use this format?

Aanjan
12-Amethyst
(To:aelgov)

Assaf, just to check, what is the 'dateTimeFormat_Default' set to in your Default Localization Table? You can set that value to 'yyyy-MM-dd HH:mm:ss.SSS' for the datetime to be displayed/ rendered with milliseconds.

Announcements


Top Tags