[Gambas-user] Daylight "saving" and time zones

Jussi Lahtinen jussi.lahtinen at gmail.com
Mon Oct 28 02:21:39 CET 2019


Here is the code (see attachment). I hope I didn't mess anything up as I
banged my head with this problem...
Look at LoadAlarms and SaveAlarms in Main module. As you can see the dates
are read and written always assuming local date.
But that does not work. I have tried so many ways...


Jussi

On Mon, Oct 28, 2019 at 3:00 AM Jussi Lahtinen <jussi.lahtinen at gmail.com>
wrote:

>
>
> > I found my answer. It's no. I just got this: "10/28/2019 02:04:23.316"
>>
>> No idea how you could get that with Date(2019,10,27,2,30) at the
>> beginning!
>>
>
> I meant the output format when any date is converted with cstr. I wasn't
> clear.
>
>
> Of course not: you wrote 13:00 *in London*, so you get the time zone
>> associated with your time (I assume you have a date of course with it).
>> "13:00" is not always correct, it means nothing per se. It's "13:00 *in
>> London*" that is always correct, with the time zone.
>>
>
> The problem is, you cannot do that in Gambas at least in any easy way.
> With Date.FromUTC I can put things in UTC, but if I have to use Hour(),
> Format(), etc, etc it is ruined again.
> Reason I want to use UTC consistently or even better ignore time zones
> completely is, I need the times & dates written on hard disk mean something
> despite of being read on different time zones. See below, very difficult to
> explain.
>
> Now the situation is following, example; I'm in Finland at summer and I
> plan meeting in winter still in Finland, let's say 28.10.2019 12:00.
> Now when the winter comes, suddenly my calendar says the meeting is
> 28.10.2019 11:00, because the local time has changed.
>
> And Tobias here is the problem. When the date & time is written on hard
> disk, there is no information what was the time zone at the time of the
> writing. Thus there is no consistent definition for local time. It can be
> anything and it is *automatically interpreted as* *current* (which may be
> different than the original) *local time*. Only consistent definition is
> for UTC, it's always the same.
>
> Also, I can write the dates & times as UTC to hard disk, but again when
> reading them, are they interpreted as *current* local time, not the local
> time they was set (and then written as UTC).
>
> Is it any clearer now?
>
>
> Jussi
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20191028/9508f950/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: GAlarm-0.3.11.tar.gz
Type: application/gzip
Size: 70439 bytes
Desc: not available
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20191028/9508f950/attachment-0001.gz>


More information about the User mailing list