Datediff differences in US and Europe

Ivan Smahin ivan_smahin at paradigmasoft.com
Thu Jun 28 13:58:22 CDT 2012


On Jun 28, 2012, at 7:59 PM, jda wrote:

> 
> On Jun 28, 2012, at 12:43 PM, Robert Brenstein wrote:
> 
>> On 27.06.2012 at 10:07 Uhr -0400 jda apparently wrote:
>>> 
>>> 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).
>> 
>> Actually, in Germany, such a date would normally be written 01.01.1904
>> Also, don't forget that the month and day are swapped.
>> 
>> Since I can change the format and the order of items as I wish on my Mac, you either need to use a standardized input format or be able to parse current user settings (unless now() does it for you).
> 
> Ah, you're right. Using
> 
>     01.01.1904
> 
> works for German settings.
> 
> Interestingly, for French and Italian the same setting works as for the US:
> 
>     01/01/1904
> 


Firstly - there are different:
American standard is : MM//DD/YYYY
But Europe tends to DD/MM/YYYY (delimiter might be different)

Secondly, some of DBMS accepts "universal format"  - YYYY-MM-DD along with a local specific format.
I mean you can hardcode "insert into t1 values ('1904-01-01')" and it should work regardless of a current date format.

What do you think of it - should Valentina follow such a rule or not?
(Personally, I'm not sure that using any sort of literals is a good practice (well known magic numbers))

-- 
Best regards,
Ivan Smahin
Senior Software Engineer
Paradigma Software, Inc
Valentina - The Ultra-Fast Database
http://www.valentina-db.com



More information about the Valentina mailing list