Forums / Developer / strange l10n behaviour (shortdatetime)

strange l10n behaviour (shortdatetime)

Author Message

Marko Žmak

Wednesday 10 May 2006 1:03:10 pm

I encountered a strange behaviour when using operator l10n( shortdatetime). I used this code:

{def $search_date=currentdate() $one_hour=3600 $one_day=mul(24,$one_hour)}
{def $search_date=mul(floor(div($search_date,$one_day)),$one_day)}
{$search_date|l10n( 'shortdatetime' )}

What I actually did here is divide the current timestamp with duration (in seconds) of one day, truncated the decimals and then multiplyed it with the duration a day. This should give me exactly the current date at midnight. But it gives me:

10.05.2006. 02:00

The currentdate was 10.05.2006. 21:44 (GMT +1). I checked it with server time which was Wed May 10 21:44:29 CEST 2006.

Can someone tell me where does this difference come from. I understand that I'm in GMT+1, but then it could be only on hour past the midnight, and not 2 hours. I'm really confused about this one.

Is there something wrong with currentdate() of l10n operator? Or am I missing something?

P.S. The timestamps for $serach_date are:

1147290285 - before dividng and multiplying
1147219200 - after diidng and multiplying

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth