Jump to content

Recommended Posts

Posted (edited)

How can timestamps be converted into a common time format? Do have any available functions?

1522847958000 ==> 2018-03-28

【Unix /   Linux】 date +%s -d"Jan 1, 1970 00:00:01"
【VBScript/ASP】 DateDiff("s", "01/01/1970 00:00:00", time)
Edited by Letraindusoir
Posted
51 minutes ago, Jos said:

Did you check the helpfile before asking here? ;)

Jos

I'm sorry, I'm a rookie, I'm not familiar with Autoit yet, I'll study it carefully, and hope you won't hesitate to give me a little guide suggestion.Many thanks!:)

Posted

Timestamps should be expressed in seconds elapsed since 01/01/1970 00:00:00
the timestamp number you presented seems to be espressed in milliseconds instead.

If you have a look to the _DateAdd() function in the help, there is the exmple that you need.

In short you have to add to the starting date of 01/01/1970 00:00:00 the number of seconds (not milliseconds) that you have,  and you will have the target date, that is, the date you reach after all those seconds have elapsed since then.

However, it seems that your timestamp (properly reduced to seconds) matches to 2018/04/04 and not 2018/03/28 as you indicated in OP

#include <date.au3>
Local $EpochSeconds = 1522847958 ; 000
MsgBox(0, '', _DateAdd('s', $EpochSeconds, "1970/01/01 00:00:00"))

p.s.

you can find some other formulas for conversions to / from other formats (also for AutoIt) at this link: https://www.epochconverter.com/

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Posted
11 hours ago, Chimp said:

Timestamps should be expressed in seconds elapsed since 01/01/1970 00:00:00
the timestamp number you presented seems to be espressed in milliseconds instead.

If you have a look to the _DateAdd() function in the help, there is the exmple that you need.

In short you have to add to the starting date of 01/01/1970 00:00:00 the number of seconds (not milliseconds) that you have,  and you will have the target date, that is, the date you reach after all those seconds have elapsed since then.

However, it seems that your timestamp (properly reduced to seconds) matches to 2018/04/04 and not 2018/03/28 as you indicated in OP

#include <date.au3>
Local $EpochSeconds = 1522847958 ; 000
MsgBox(0, '', _DateAdd('s', $EpochSeconds, "1970/01/01 00:00:00"))

p.s.

you can find some other formulas for conversions to / from other formats (also for AutoIt) at this link: https://www.epochconverter.com/

That's OK!Thanks Chimp !Thanks again everyone for kind Help!:ILA3:

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...