JonnyThunder Posted April 21, 2008 Share Posted April 21, 2008 Ello,I'm using this function to create a unix style integer time stamp (seconds since 1/1/1970).Can anyone tell me how to do the reverse of this function??Thanks,ConsoleWrite ( nowtime () ) ; returns 1208771333 Func nowtime () return _DateDiff( 's',"1970/01/01 00:00:00",_NowCalc()) EndFunc Link to comment Share on other sites More sharing options...
Xenobiologist Posted April 21, 2008 Share Posted April 21, 2008 Hi, #include <Date.au3> Global $re = nowtime() ConsoleWrite($re & @CRLF) ConsoleWrite(_DateAdd('s', -$re, _NowCalc()) & @CRLF) Func nowtime() Return _DateDiff('s', "1970/01/01 00:00:00", _NowCalc()) EndFunc ;==>nowtime Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
JonnyThunder Posted April 21, 2008 Author Share Posted April 21, 2008 (edited) Ahh never mind. Figured it out. Just in case anyone else likes storing date/time as integer - here's the functions.... ; Function to return current time in integer format Func nowtime () return _DateDiff( 's',"1970/01/01 00:00:00",_NowCalc()) EndFunc ; Function to return date from an unix style integer timestamp Func datefromint ( $intime ) return _DateAdd ( 's', $intime, "1970/01/01 00:00:00" ) EndFunc EDIT: Ahh, you just beat me to it! :-) Edited April 21, 2008 by JonnyThunder Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now