Datediff differences in US and Europe

jda jda at his.com
Wed Jun 27 09:07:19 CDT 2012


>> I have a method that uses datediff to determins if a record was  
>> created in the last 2 weeks:
>>
>>      dateAdded > datediff( now(), '01/01/1904 00:00:00', 'second' )  
>> - (14 * 24 * 60 * 60)
>>
>> This works well on US Macs.
>>
>> You told me to use
>>
>>       dateAdded > datediff( now(), '01-01-1904 00:00:00',  
>> 'second' ) - (14 * 24 * 60 * 60)
>>
>> for European systems. I checked this by changing my settings to  
>> German (in the International System Preferences). But not neither  
>> search works.
>>
>> So, what should I use for the day, month, and year for different  
>> regions?
>>
>
>
> I suspect that such a problem will be arisen sooner or later.
> Actually now() is about local time - so you can not use it worldwide  
> as a timestamp.
>
> Usually UTC time is used for such purposes.
> But I can not recall - do we have such a function or not.

Hi Ivan,

But that's not the problem. It works just fine form my purposes (local  
time). The problem is the format for the date parameter:

      01/01/1904

works if the system language (international setting) is set to English.

It fails if the language is set to German. I thought

      01-01-1904

would work, but the search -> no results (there should be many when  
the language is German (or English).

This is all on the same Mac in one time zone, there there should be no  
issues with now().

Jon

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macserve.net/pipermail/valentina/attachments/20120627/7883a17d/attachment.html>


More information about the Valentina mailing list