Time, date & Settings

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Time, date & Settings

Jussi Lahtinen
Hi!
I'm trying to figure way to handle time & date correctly, ignoring timezone
and "daylight saving" adjustments. I can't get things work nicely with
settings component as it does not save&load the value in universal format.
Example if you write settings in English and open them in Finnish, you will
get silent error:

Print Settings[sPath &/ "Date&Time", Null]
03/27/2017 12:00:00  <--- this is correct time

Print Val(Settings[sPath &/ "Date&Time", Null])
This returns nothing, not even error.

Print CDate(Settings[sPath &/ "Date&Time", Null])
27.03.2017 09.00.00  <--- this is incorrect time

This is from the GAlarm project and I want to ignore timezones etc, because
I want the alarms go off accordingly to the computer clock. IE alarm set to
go off at 12:00 should go off, if computer clock shows 12:00. Not at 09:00,
because I cannot know what timezone the user meant, so I always assume
local.


Do I have to write seconds, minutes, hours, etc separately in the settings
or could this be fixed somehow..?



Jussi
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|

Re: Time, date & Settings

PICCORO McKAY Lenz
similar behavior occurs me when i swicht languajes and manipulates amounts
in my POS system, in english vs spanish decimals alternate with "," and "."
and theres no way to use an universa only form..

u must stored separated..

Lenz McKAY Gerardo (PICCORO)
http://qgqlochekone.blogspot.com

2017-03-26 20:11 GMT-04:00 Jussi Lahtinen <[hidden email]>:

> Hi!
> I'm trying to figure way to handle time & date correctly, ignoring timezone
> and "daylight saving" adjustments. I can't get things work nicely with
> settings component as it does not save&load the value in universal format.
> Example if you write settings in English and open them in Finnish, you will
> get silent error:
>
> Print Settings[sPath &/ "Date&Time", Null]
> 03/27/2017 12:00:00  <--- this is correct time
>
> Print Val(Settings[sPath &/ "Date&Time", Null])
> This returns nothing, not even error.
>
> Print CDate(Settings[sPath &/ "Date&Time", Null])
> 27.03.2017 09.00.00  <--- this is incorrect time
>
> This is from the GAlarm project and I want to ignore timezones etc, because
> I want the alarms go off accordingly to the computer clock. IE alarm set to
> go off at 12:00 should go off, if computer clock shows 12:00. Not at 09:00,
> because I cannot know what timezone the user meant, so I always assume
> local.
>
>
> Do I have to write seconds, minutes, hours, etc separately in the settings
> or could this be fixed somehow..?
>
>
>
> Jussi
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Gambas-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|

Re: Time, date & Settings

Benoît Minisini
Le 27/03/2017 à 07:27, PICCORO McKAY Lenz a écrit :

> similar behavior occurs me when i swicht languajes and manipulates amounts
> in my POS system, in english vs spanish decimals alternate with "," and "."
> and theres no way to use an universa only form..
>
> u must stored separated..
>
> Lenz McKAY Gerardo (PICCORO)
> http://qgqlochekone.blogspot.com
>
> 2017-03-26 20:11 GMT-04:00 Jussi Lahtinen <[hidden email]>:
>
>> Hi!
>> I'm trying to figure way to handle time & date correctly, ignoring timezone
>> and "daylight saving" adjustments. I can't get things work nicely with
>> settings component as it does not save&load the value in universal format.
>> Example if you write settings in English and open them in Finnish, you will
>> get silent error:
>>
>> Print Settings[sPath &/ "Date&Time", Null]
>> 03/27/2017 12:00:00  <--- this is correct time
>>
>> Print Val(Settings[sPath &/ "Date&Time", Null])
>> This returns nothing, not even error.
>>
>> Print CDate(Settings[sPath &/ "Date&Time", Null])
>> 27.03.2017 09.00.00  <--- this is incorrect time
>>
>> This is from the GAlarm project and I want to ignore timezones etc, because
>> I want the alarms go off accordingly to the computer clock. IE alarm set to
>> go off at 12:00 should go off, if computer clock shows 12:00. Not at 09:00,
>> because I cannot know what timezone the user meant, so I always assume
>> local.
>>
>>
>> Do I have to write seconds, minutes, hours, etc separately in the settings
>> or could this be fixed somehow..?
>>
>>
>>
>> Jussi

Using the development version, you have to store your date in the
settings file using CStr(), and read it using CDate().

Regards,

--
Benoît Minisini

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|

Re: Time, date & Settings

Jussi Lahtinen
> Using the development version, you have to store your date in the
> settings file using CStr(), and read it using CDate().
>

That does not work if the settings file is written in English and opened in
Finnish. CDate() just fails silently (returns null).


Jussi
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|

Re: Time, date & Settings

Benoît Minisini
Le 27/03/2017 à 17:02, Jussi Lahtinen a écrit :
>> Using the development version, you have to store your date in the
>> settings file using CStr(), and read it using CDate().
>>
>
> That does not work if the settings file is written in English and opened in
> Finnish. CDate() just fails silently (returns null).
>
>
> Jussi

It should not with the development version, as CDate() and CStr() only
use the american format.

--
Benoît Minisini

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|

Re: Time, date & Settings

Jussi Lahtinen
OK, forgot to update Gambas on my virtual machine...

But now there is another problem. I'm in UTC+3, and when I write the time
(example 12:00) with CStr(), it will be 15:00 in the settings file. Now if
I go to UTC-0, I will get the alarm when my computer clock shows 15:00. I
want it always assume local time.

Example if I have meeting in UK at 31.3.2017 12:00, I want simply set the
alarm for 31.3.2017 12:00, independently of where I'm now. The device I'm
using should worry about timezones not me.


Jussi

On Mon, Mar 27, 2017 at 6:15 PM, Benoît Minisini <
[hidden email]> wrote:

> Le 27/03/2017 à 17:02, Jussi Lahtinen a écrit :
> >> Using the development version, you have to store your date in the
> >> settings file using CStr(), and read it using CDate().
> >>
> >
> > That does not work if the settings file is written in English and opened
> in
> > Finnish. CDate() just fails silently (returns null).
> >
> >
> > Jussi
>
> It should not with the development version, as CDate() and CStr() only
> use the american format.
>
> --
> Benoît Minisini
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Gambas-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user