Skip to main content
1-Visitor
November 17, 2021
Solved

Get actual Time Stamp

  • November 17, 2021
  • 2 replies
  • 2527 views

Hey Guys! As we can't import libraries into Thingworx, I have a problem regarding a time stamp. 

For my factory I need to generate the time stamp in the following format: YYYY-MM-DDThh:mm:ss.fffZ in UCT standard time. 

 

When I use: var date = dateFormat(new Date(), "MMMMM d, yyyy hh:mm:ss"); The date returns obviously in the "MMMMM d, yyyy hh:mm:ss" format. I use this format, becasue I can't use "YYYY-MM-DDThh:mm:ss.fffZ" in the dateFormat-function, because then a failure is returned regarding the T and the Z. 

 

I hope anyone can help me to return the actual UCT time in the following format: "YYYY-MM-DDThh:mm:ss.fffZ"

 

2 replies

PaiChung22-Sapphire IAnswer
22-Sapphire I
November 17, 2021
1-Visitor
November 22, 2021

Thank you! This seems like it's working.

24-Ruby III
November 17, 2021

Additional article - "How to change the default timestamp display in ThingWorx": https://www.ptc.com/en/support/article/cs232236 

1-Visitor
November 22, 2021

Thank you for the reply! Unfortunately I have to have the T & Z into the time stamp.