Solved Convert UNIX timestamp to DateTime

Pete_L

Active Member
Hi,
Does anyone know how to convert a UNIX timestamp to a DateTime in Blue Prism? A UNIX timestamp is the number of seconds since 1/1/1970, and looks something like this: 1612344495790, which should convert to 2/3/2021 09:28:15 GMT.

Thank you.
 

sahil_raina_91

Active Member
Hi,
Does anyone know how to convert a UNIX timestamp to a DateTime in Blue Prism? A UNIX timestamp is the number of seconds since 1/1/1970, and looks something like this: 1612344495790, which should convert to 2/3/2021 09:28:15 GMT.

Thank you.

VB.Net Code:
INPUT : UnixTime (text)
OUTPUT : ConvertedDateTime (text)

Dim t As New DateTime
t = DateTime.Parse("January 1 1970 12:00:00 am")
ConvertedDateTime = t.AddSeconds(UnixTime/1000).ToString
 

Pete_L

Active Member
VB.Net Code:
INPUT : UnixTime (text)
OUTPUT : ConvertedDateTime (text)

Dim t As New DateTime
t = DateTime.Parse("January 1 1970 12:00:00 am")
ConvertedDateTime = t.AddSeconds(UnixTime/1000).ToString
This is just what I was looking for, and it works perfectly. Thank you, sahil_raina!
 
Top