[Gambas-user] Best way converting dates into strings forth and back

Jussi Lahtinen jussi.lahtinen at gmail.com
Fri Dec 10 23:49:20 CET 2021


Again, in different words. Here we give the date in local time and get the
output in UTC:

? Cstr(Date(2021, 12, 10, 22, 27))
12/10/2021 20:27

? Cstr(Date(2021, 12, 10, 22, 27))
12/10/2021 19:27

Depending if it is winter or summer. So, it doesn't work. The problem is in
the loss of information. IE the relevant information is not stored.

Does anyone else understand the issue?


Jussi


On Sat, Dec 11, 2021 at 12:06 AM Jussi Lahtinen <jussi.lahtinen at gmail.com>
wrote:

> Benoit, you misunderstand what I mean.
>
>
>
>> "12/10/2021 20:27 UTC" is different from "12/10/2021 19:27 UTC", so they
>> are not the same date/time.
>
>
> Of course, but they both are the result of converting the same *local*
> date "10.12.2021 22:27" into UTC.
>
>
>
>> If you store the same date/time in an UTC string representation, you
>> will have the same string, otherwise it is not the same date/time.
>>
>
> Yes, Cstr(CDate("12/10/2021 22:27")) = "12/10/2021 22:27". I know this.
> But it solves nothing, because still the second case applies.
>
>
>
>
>> When you use the expression "the same date in UTC", you show that you
>> are confusing dates with their string representation.
>>
>
> Of course I meant the same date converted into UTC.
>
>
> My full explanation of how dates work in Gambas is at:
>> https://gambaswiki.org/wiki/doc/date
>>
>> I strongly suggest that you read it carefully.
>>
>
> Done, many times. Two times again today. It does not say anything about
> what I'm talking about.
>
>
> Jussi
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20211211/aeb2761f/attachment-0001.htm>


More information about the User mailing list