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

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

Timestamp to DATE

ketanaga
14-Alexandrite

Timestamp to DATE

Hi 

 

I am using a CSV parser extension to import a CSV file from the local machine. The timestamp is in UNIX format and I want to convert it into a proper DATETIME format. The datashape basetype for Timestamp is number.

Is there a way to convert it into

ACCEPTED SOLUTION

Accepted Solutions
iguerra
15-Moonstone
(To:ketanaga)

Try looping your result infotable, and for each row assign the new date with this logic

ConvertedDate = new Date(unix_timesamp * 1000);

 

View solution in original post

4 REPLIES 4

Hi,

 

Try this in a service:

 

var date = new Date(timestamp * 1000);
result= date;

 

Hope it helps,

Raluca Edu

ketanaga
14-Alexandrite
(To:raluca_edu)

Hi raluca_edu

 

Thanks for the quick response.

What I am trying to do here is getting the Timestamp values from the CSV file and I want them to be converted into DATETIME(for which you have given the snippet). I am stuck at a point where I want to convert the entire Timestamp column and the result should be in the same Infotable with Date column and Basetype already initialised in the Datashape

Attached is a screenshot of the service result. I want the DATETIME result to be populated there itself

iguerra
15-Moonstone
(To:ketanaga)

Try looping your result infotable, and for each row assign the new date with this logic

ConvertedDate = new Date(unix_timesamp * 1000);

 

slangley
23-Emerald II
(To:ketanaga)

Hi @ketanaga.

 

If one of the previous responses answered your question, please mark the appropriate one as the Accepted Solution for the benefit of others with the same question.

 

Regards.

 

--Sharon

Announcements


Top Tags