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

How to convert a epoch timestamp String to a readable date time format?

diparnab-dey1
Deputy Chef I
Deputy Chef I

Hi Team, 

I have a use case where I need to convert an epoch milliseconds String to a readable Date time format in Workato. I know that this is possible using the following Ruby method 

 timestamp1 = Time.at("1696731696612".to_i/1000.0).strftime("%Y-%m-%d %H:%M:%S")

However, seems like Workato does not support the  Time.at method. Is there any other way which can be used here ? Also, is there a plan to whitelist this Ruby method in future ? 

1 ACCEPTED SOLUTION

marlon-muela
Workato employee
Workato employee

Hi @diparnab-dey1 ,

Here's a sample formula that you can use. You can use .to_time formula for converting an epoch value.

marlonmuela_0-1698667298676.png

Output as a valid date:

marlonmuela_1-1698667322492.png

 

View solution in original post

3 REPLIES 3

marlon-muela
Workato employee
Workato employee

Hi @diparnab-dey1 ,

Here's a sample formula that you can use. You can use .to_time formula for converting an epoch value.

marlonmuela_0-1698667298676.png

Output as a valid date:

marlonmuela_1-1698667322492.png

 

diparnab-dey1
Deputy Chef I
Deputy Chef I

Thanks @marlon-muela  This worked like a charm. One question though. The default time returned by this formula is in UTC or PDT ? 

I believe that this is based on the account settings. You can use .in_timezone formula to convert the date/time into a specific timezone.