Re: [SMARTY] date formatting
messju mohr <[email protected]> Thu, 4 Oct 2007 16:11:57 +0200
| Newsgroups | gmane.comp.php.smarty.general |
|---|---|
| Message-ID | <[email protected]> |
On Thu, Oct 04, 2007 at 03:06:24PM +0200, Vincent DEBOUT wrote:
> hello,
>
> > hello,
> >
> > in my template I have an input field which contains the date a shelf
> > expires.
> >
> > Given the value for $shelf_expire_value is 2099-12-31 the template
> > returns just that.
> >
> > If I use:
> > value="{$shelf_expire_value|date_format:'%d.%m.%Y'}" instead of
> > value="{$shelf_expire_value}" I get the result: 04.10.2007, which is
> > today's date...
> >
> > Is date_format only working with a certain type (format) of string? How
> > can I get the desired output of: 31.12.2099?
>
> The documentation says: "Dates can be passed to Smarty as unix timestamps,
> mysql timestamps or any string made up of month day year, parsable by
> php's strtotime()."
> The strtotime function accepts only english dates. 31.12.2099 is not an
> english date!!
> Take a look here : <http://fr3.php.net/manual/en/function.strtotime.php>
No, Peggy does not pass DD.MM.YYYY, she passes YYYY-MM-DD, which is
fine for strtotime() and wants DD.MM.YYYY as output. The problem is,
that the range strftime() (and strtotime()) can handle is limited by
the underlying operating system. My system for example will only
handle dates correctly up to january 2038.
> Regards,
> Vincent
--
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php