Datediff differences in US and Europe

jda jda at his.com
Thu Jun 28 14:51:47 CDT 2012


>>
>> 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)

Hi Ivan,

True. For calculating offset dates on a Mac, the "start" date is  
01/01/1904, so luckily the day/month order is irrelevant.

>
> 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.

That seems reasonable.

>
> 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))

Personally, I would think that the format should be platform and  
locale neutral so none of this matters. Having a universal format does  
that.

BTW, I'm open to any other suggestion about how to determine, in SQL,  
if a record was added within a certain time X before the present. That  
is

select * from t1 WHERE dateAdded > current time - 14 days

Jon


More information about the Valentina mailing list