[TYPO3-dev] DATETIME field without considering locale

Bernhard Kraft kraftb at kraftb.at
Mon Feb 6 15:10:10 CET 2006


Christian Lerrahn wrote:
> Hi,
> I've written an extension that uses 2 datetime fields. However, I'm
> realizing that the locale of my client is always considered. The default
> value is my current local time and whatever I enter will be considered a
> time in my timezone. As the server is in a different timezone though and
> the times and dates I enter shall show up the way I enter them, this is
> very inconvenient. Is there a way to make an entered time in a datetime
> filed absolute? Or can someone just point me to the specs of the array
> properties of the field definitions? I searched the core references but
> couldn't find anything that was suitable.


Hello !

I had this problem with date fields where a birthday should get entered.
Now it's the case if you sit for example in GMT+2 (Eastern europe) and enter
a date like 20-10-1980 (my birthday :) it will get converted to a UNIX timestamp
(which of course hasn't got any timezones) and transfered to the server which
is in GMT+1. As at the timepoint of 0:0 20-10-1980 it is 23:00 19-10-1980 the date
always showed up with one day before on the server.

I communicated this problem to the other core-dev's and there is a solution from
me at:
http://bugs.typo3.org/view.php?id=1697
(bug_1697_2006-01-20_CVS.diff)

You can follow the discussion on the core list at:
http://lists.netfielders.de/pipermail/typo3-team-core/2006-January/001364.html


But this solution (I enter the date/times as I would be in the same timezone of the
server) is in my opinion not always the best as for example if you are in a big
international company it is questionable how the behaviour should be.

Exampl:
Server in GMT+1 (Central Europe).
Employe of BIC (Big international company) is in GMT+8 (Singapure). If he now enters
a "News" for example he could probably want to input
12:00 06-01-2006 into the Date Field of the News and wants to get it converted to whatever
this means in CET.
It could also be required that an editor can choose in which timezone he "means" a value.
In the FE it should be possible to set the timezone in which strftime outputs a value (normally
it does it depending on the locale - but you can overcome this by adding +3600*n to the timestamp)

I would be really interested in discussing this.
I can be found on #typo3 on irc.freenode.net (kraftb)
or via ICQ: #113830220 (Krufti)

greets,
Bernhard




More information about the TYPO3-dev mailing list