[Gambas-user] Date(Now) with time component under Ubuntu?

Rolf-Werner Eilert rwe-sse at osnanet.de
Thu Dec 6 13:03:52 CET 2018


Yes Bruce,

I didn't realize before I ran into this, but as far as I understand now

CStr(Now) should be local date + time
Str(Now)  should be UTC

But when you convert implicitly, i. e. without using CStr, you can get 
yesterday's date. At least I had this strange thing with

myStringVar = Date(Now)

would deliver 5th December today + time component in UTC. I don't 
understand why, but I can work around it, as I have to re-write all date 
operations in that program anyway.

Regards
Rolf


Am 06.12.18 um 12:51 schrieb Bruce:
> Rolf,
> This is really good.
> When is Now()? Is it the UTC now, or the local now?
> Forget the Date() bit.
> b
> 
> On 6/12/18 9:52 pm, Rolf-Werner Eilert wrote:
>> Hi Benoit,
>>
>> This is contradictional:
>>
>>> Date(Now) -> Return the date part, in the current localization (i.e. 
>>> the current timezone). It means that the time part is set to 
>>> 00:00:00, but in the current timezone.
>>
>> The help says:
>>
>> Date
>>
>> Result = Date ( [ Expression ] )
>>
>> Return the date part of a date & time expression. If the expression is 
>> omitted, then the today date is returned.
>>
>> The current localization is used, i.e. the date part in the current 
>> timezone is returned.
>>
>> Example
>>
>> Print Now; " -> "; Date(Now)
>>
>> 05/16/2002 15:10:59 -> 05/16/2002
>>
>>
>> But what I get back is something like
>>
>> 05/16/2002 00:00:00
>>
>> This should either not be the case, or be corrected in the help. The 
>> Day, Month, Year components are delivered correctly of course, as they 
>> are only integers.
>>
>> Everything else works like you described, i. e. I have to look for 
>> unclear string conversions etc.
>>
>>
>>
>> Regards
>> Rolf
>>
>> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
> 
> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
> 
> 



More information about the User mailing list