[Gambas-user] Probelm with Date

Benoit Minisini gambas at ...1...
Thu Jun 23 12:28:54 CEST 2005


On Wednesday 22 June 2005 23:18, PaquitoSoft wrote:
> Hi all!
>
> I'm wondering about Date data type.
> Is there anyway to do something like this???
>
> DIM date as DATE
>
> date = Now()
> PRINT "Yesterday -> " & (date - 1)
>
>
> I kwon you can do in VB, but in Gambas it says that they are
> incompatible types (of course they are...)
>
> Any answer??
>
> Thanks a lot

Date are stored internally as a number of days and a number of microseconds. 
To have the same behaviour than in VB, you must explicitely convert dates to 
float:

date = Now()
PRINT "Yesterday is "; CDate(CFloat(date) - 1)

Regards,

-- 
Benoit Minisini
mailto:gambas at ...1...




More information about the User mailing list