[Typo3] Date formats for task force extension

JoH info at cybercraft.de
Tue Mar 29 20:18:24 CEST 2005


>> remembered a thread about problems with the US date format a few
>> days ago and so there is a very simple question, almost anybody of
>> you could answer. To make the extension "international" I need to
>> know:
>
> ... you need to know these PHP functions:
>
>   - localeconv or nl_langinfo
>   - strftime
>
> You should rely on a proper configured locales configuration, then
> it's quite easy to format a date fx. with strftime ('%c', $timestamp);
>
> Conversion back is a bit tricky, but you can use the information from
> nl_langinfo to do a proper parsing.

Conversion back is the only problem I have, since I have to check a given
value before it is written into DB.

But just another idea:
Since I use stdWrap properties for the output of different fields, the user
can setup the desired date/time format anyway.
Something like
  begin_change {
      wrap = <p>Beginn:<br /><input name="change[begin]" value="|"></p>
      strftime = %d.%m.%y - %H:%M
    }
will format the value of an input field for german date/time style.
For the output of the same field in "readonly" mode I can use
  begin {
      wrap = <p>Beginn:<br /><input name="change[begin]" value="|"></p>
      strftime = %e. %B %Y - %H<sup>%M</sup> Uhr
    }
since there will be nothing to check with that value.
Maybe it's more elegant to use the TS property of the input field for the
function that checks, if the given value is a correct date.
This way I wouldn't need any locale at all, only the prefered format given
by the admin, and during the check I can use a universal function that
doesn't care if the current locale is set on the server.

But I guess this "universal" function will be even more tricky ...

Joey

-- 
Wenn man keine Ahnung hat: Einfach mal Fresse halten!
(If you have now clues: simply shut your gob sometimes!)
Dieter Nuhr, German comedian
openBC: http://www.openbc.com/go/invuid/Jo_Hasenau





More information about the TYPO3-english mailing list