[Gambas-user] gb3: date/time reporting odd fractional value

Fabien Bodard gambas.fr at ...626...
Thu Jun 23 16:42:34 CEST 2011


Le 23 juin 2011 13:33, Benoît Minisini <gambas at ...1...> a écrit :
>> On 06/23/2011 02:46 AM, Benoît Minisini wrote:
>> >> According to some previous answers to my questions about performing
>> >> arithmetic operations on dates and times, the fractional part of a date
>> >> (cfloat[now] - fix[cfloat(now)]) represents the time of day and the
>> >> integer part (fix[cfloat(now)]) represents the number of days elapsed
>> >> since the beginning of time.
>> >>
>> >> So if it's 12:00 PM then cfloat(now) should display x.5, meaning half
>> >> the day has passed.
>> >>
>> >> If I enter ?cfloat(now) in the immediate window I get something like
>> >> 2487839.71017654 even though it's 10:02 PM. If x.0 is midnight, x.5 is
>> >> noon, etc., how is x.7 10:00 PM? Shouldn't 10:00 PM be something closer
>> >> to x.916666674?
>> >>
>> >> I thought at first it was because I was scaling time, but the immediate
>> >> window proved that wrong (immediately!). Any insight appreciated as
>> >> always.
>> >
>> > Date/time values are internally stored in GMT time.
>>
>> I'm reading about GMT on Wikipedia now... How would one interpret the
>> returned values with respect to GMT?
>
> Sorry, we should not say "GMT" anymore, but "UTC" instead.
>
> For example, in France, the time zone is "-1". It means that dates in France
> are one hour earlier than in UK (which has a time zone of "0", i.e. the UTC is
> used).
>
> As Gambas must internally store dates independently of the location, it uses
> UTC.
>
> So, in France, Gambas stores dates one hour later, and does the contrary when
> printing them.
>
> In other words, if you send "23/06/2011 10:00:00" from a Gambas program
> running on a french computer to a Gambas program running on an english
> computer, it will receive "23/06/2011 11:00:00". But, internally, it will be
> the same date.
>
> Regards,
>
> --
> Benoît Minisini
>
> ------------------------------------------------------------------------------
> Simplify data backup and recovery for your virtual environment with vRanger.
> Installation's a snap, and flexible recovery options mean your data is safe,
> secure and there when you need it. Data protection magic?
> Nope - It's vRanger. Get your free trial download today.
> http://p.sf.net/sfu/quest-sfdev2dev
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>

so if i store a date in a db .... for exemple 10:00 and then if an
english computer query the data ... what data it display ... the date
at the english zone ?



-- 
Fabien Bodard




More information about the User mailing list