> Hi Benoit,
> 
> I have just a question about the possibility to convert in Gambas v2 a
> variable in format Date to a value of this date in number of seconds like
> in Unix command ?
> 
> In my projet i need to use date value in number of seconds and not in
> standard format as for example this one: not    26-09-2010 17:08:00   but 
>    in seconds  since 1970-01-01 00:00:00  =>  1285513680  seconds
> 
> I just want to know if it possible or not in Gambas v2 otherwise I will
> continue to use the Unix command 'date' ?
> 
> Thank in advance,
> 
> Olivier Cruilles
> Mail: linu...@club-internet.fr
> 

Dates are internally stored as a number of seconds and microseconds from a 
Gambas epoch (which is not the Unix epoch), in GMT. 

When converted to Float, you get a number of days as integer part, and the 
rest as decimal part.

So, if you need a unix timestamp, i.e. a number of seconds since epoch, you 
just have to do that:

Print Int((CFloat(now) - CFloat(Date(1970, 1, 1))) * 86400)

Regards,

-- 
Benoît Minisini

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to