[Gambas-user] Format function changes date value
Benoît Minisini
g4mba5 at gmail.com
Thu Jun 7 20:50:56 CEST 2018
Le 07/06/2018 à 20:34, ML a écrit :
>>
>> Hi Benoit,
>> sorry for the delay, I had to go out.
>> The difference between local and UTC is clear to me.
>> I find it difficult to memorize, to fix well in my mind, to fully
>> understand the translation into the string.
>> Suppose we have a CUsers class where I store user data including the
>> date of birth.
>> Suppose I use this class as an array:
>> hObj = New CUsers (iId, sName, sSurName, dDate, ...)
>> $hGlobalObject.Add(hObj)
>> If I have to save the date in an ini file like Settings and I want to
>> be sure that I do not have problems, how do I translate the date to be
>> saved into a string, and then how can I re-translate it into a date
>> format from ini?
>> So I'm in confusion, I would use CStr and then CDate to stay in UTC
>> and then display the dates with Format.
>> I know I'm an idiot, and I'll continue to use a database...
>> Regards
>> Gianluigi
Save it in UTC with CStr(), and read it back with CDate().
As for databases, the gb.db component store dates & times are stored UTC
as much as possible.
Of course, this is far more complex than that as every SQL database has
it own way of dealing with dates. Gambas database component tries to
hide all the quirks.
--
Benoît Minisini
More information about the User
mailing list