Convert UNIX serverTime number into Date Format (ddmmyyyy hh:mm:ss)

Hi there.

i’m parsing a json object fom an API endpoint
I don’t know how to use TimeSPAN in such way that can transform the number that I receive, into a Date Format like ddmmyyyy hh:mm:ss.

Thanks in advance

Cheers

@Tracerecart

Welcome to our UiPath community.

Can you show us UNIX ServerTime. So that we can check and help you.

Shure

UTC

serverTime: 1632488118

milliseconds I believe

Thank you

Hi, welcome!

Your UNIX Timestamp seems to be Seconds since Epoch!

The Unix epoch (or Unix time or POSIX time or Unix timestamp ) is the number of seconds that have elapsed since January 1, 1970 (midnight UTC/GMT), not counting leap seconds
https://www.epochconverter.com/

You can get regular DateTime like this:

EpochDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc)

Then add UNIX Timestamp

SampleDateTime = EpochDateTime.AddSeconds(UnixTimeStamp).ToLocalTime

Of course, UnixTimeStamp should be numeric.

Your serverTime is today, just under 10 minutes ago.

Happy automating

2 Likes

It worked like a charm.

Cheers my friend.

1 Like

grafik

5 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.