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

Rolf Schmidt rolf.frogs at ...221...
Fri Feb 3 18:41:43 CET 2012


Hello Benoît

> 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)
>

After swapping the last two arguments of DateAdd it works as expected.
Perhaps this could be a note in the documentation of Gambas.

Many Thanks
Rolf




More information about the User mailing list