Jump to content

Timestamp


gosu
 Share

Recommended Posts

How to get the current timestamp with AutoIt?

Cheers

[quote name='d2hacker88' date='Jan 6 2005, 05:10 PM']Can someone please help me out with autoit like gimme a link on how to use it cause i have no experience with computer languages and i'd like to make a program with autoit in order to empress my computer teacher.[right][snapback]52215[/snapback][/right][/quote]

Link to comment
Share on other sites

@HOUR @MIN @SEC

<{POST_SNAPBACK}>

A timestamp is the seconds that have gone since the ?. ?. 1970. The date macros don´t help me.

Thanks anyway.

[quote name='d2hacker88' date='Jan 6 2005, 05:10 PM']Can someone please help me out with autoit like gimme a link on how to use it cause i have no experience with computer languages and i'd like to make a program with autoit in order to empress my computer teacher.[right][snapback]52215[/snapback][/right][/quote]

Link to comment
Share on other sites

A timestamp is the seconds that have gone since the ?. ?. 1970. The date macros don´t help me.

Thanks anyway.

<{POST_SNAPBACK}>

Do what? What exactly are you wanting... what stands for ?. ?. 1970? I dont understand how that relates to a timestamp.

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

  • Developers

A timestamp is the seconds that have gone since the ?. ?. 1970. The date macros don´t help me.

Thanks anyway.

<{POST_SNAPBACK}>

Not sure if that is always the meaning of timestamp ... :idiot:

If you want the know the seconds elapsed since a given date/time then use the Datenew.au3 from my autoit3 stuff page and use command:

_DateDiff("s", $sStartDate, $sEndDate)

Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Like JdeB said:

@HOUR @MIN @SEC
Will give you a timestamp

You could place this in a variable also:

$timestamp = @HOUR & ":" & @MIN & ":" & @SEC

Maybe you're looking for something different?

Please ... Elaborate

We have enough youth. How about a fountain of SMART?

Link to comment
Share on other sites

Do what? What exactly are you wanting... what stands for ?. ?. 1970? I dont understand how that relates to a timestamp.

JS

<{POST_SNAPBACK}>

I mean unix timestamps. I don´t really remember the correct date (LOL), but it was when unix was created.

Not sure if that is always the meaning of timestamp ... :idiot:

If you want the know the seconds elapsed since a given date/time then use the Datenew.au3 from my autoit3 stuff page and use command:

_DateDiff("s", $sStartDate, $sEndDate)

<{POST_SNAPBACK}>

Thank you, I will look for that file.

Sry, I meant unix timestamp. In Germany, we just say timestamp to it.

Edited by gosu

[quote name='d2hacker88' date='Jan 6 2005, 05:10 PM']Can someone please help me out with autoit like gimme a link on how to use it cause i have no experience with computer languages and i'd like to make a program with autoit in order to empress my computer teacher.[right][snapback]52215[/snapback][/right][/quote]

Link to comment
Share on other sites

He's looking for the number of seconds elapsed since the epoch commonly used for computers, January 1, 1970 00:00:00 (Midnight).

Edit: Added time to the date.

<{POST_SNAPBACK}>

Thanks Valik.

That being the case...

You can use the macros and just subtract the epoch from the timestamp.

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

  • Developers

Thanks Valik.

That being the case...

You can use the macros and just subtract the epoch from the timestamp.

JS

<{POST_SNAPBACK}>

You lost me.... how would you do that ??

I know the _DateDiff() should be able to do it, but you make it sound like it is simple ...

Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

It is simple...

#include <DateNew.au3>
$EPOCH = "1970/01/01 00:00:00"
$NOW = _NowCalc()
$time = _DateDiff("s", $EPOCH, $NOW)
MsgBox(4096, "", $time)

Edit: Replaced macro use with _NowCalc() and added #include directive.

Edited by Valik
Link to comment
Share on other sites

That is correct. Though I probably wouldnt have done the so easy part of just using your DateDiff function as I generally like writing my own stuff :D

Easy Smeazy :idiot: Thanks Valik for spelling it out for us.

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

@Valik, i knew how...  just liked the way JS made it sound sooooo easy ....

<{POST_SNAPBACK}>

I tend to do that. :idiot:

JS

Edited by JSThePatriot

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

  • Developers

I tend to do that.

JS

<{POST_SNAPBACK}>

I know.... But tryuing to keep an open mind to others when it really can be done in a simple way ... so thats why i said : Show me .... :idiot:

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Most things are simple if you know what you're doing.  :idiot:

<{POST_SNAPBACK}>

haha... That will go into your quotes for sure.

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

BTW, I am still working on the whole quotes deal. :idiot: I cant wait till I get some more time. I think it will be big :D

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

  • 1 year later...

It is simple...

#include <DateNew.au3>
$EPOCH = "1970/01/01 00:00:00"
$NOW = _NowCalc()
$time = _DateDiff("s", $EPOCH, $NOW)
MsgBox(4096, "", $time)

Edit: Replaced macro use with _NowCalc() and added #include directive.

That's great! But how can I "retranslate" a unix timestamp into two variable: $time (for the time) and $date (for the date)?

Cheers

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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