[Gambas-user] How to convert unix timestamp into gambas date and time

Benoît Minisini gambas at ...1...
Fri Feb 3 16:07:26 CET 2012


Le 03/02/2012 15:48, Rolf Schmidt a écrit :
>
> @Ron.
> Your Module is excellent, but I can't belief, that a programming
> language for the UNIX-environment isn't able to handle timestamps only
> after "reinventig the wheel".
> I think, we shoud ask Benoit why he didn't implement such a function or
> where he hide the information.
>
> Rolf.
>

Unix time stamp is a number of seconds since 1/1/1970.

So to convert a Gambas date to Unix timestamp:

	Print DateDiff(CDate("1/1/1970"), Now, gb.Second)

And to convert an Unix timestamp to Gambas date:

	Print DateAdd(CDate("1/1/1970"), TimeStamp, gb.Second)

-- 
Benoît Minisini




More information about the User mailing list