|
From: Peggy Schatz on 4 Oct 2007 08:59 hello, in my template I have an input field which contains the date a shelf expires. <input type="text" name="{$shelf_expire.name}" value="{$shelf_expire_value}" class="bg{$shelf_expire.farbe}" size="{$shelf_expire.breite}" {$shelf_expire.readstatus} /> 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? Thanks in advance, Peggy
From: "Vincent DEBOUT" on 4 Oct 2007 09:06 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> Regards, Vincent
From: messju mohr on 4 Oct 2007 10:11 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
From: Peggy Schatz on 4 Oct 2007 10:28 Thanks to you both! I just figured out the problem when reading the doc provided: (docs) Note: The valid range of a timestamp is typically from Fri, 13 Dec 1901 20:45:54 GMT to Tue, 19 Jan 2038 03:14:07 GMT. (These are the dates that correspond to the minimum and maximum values for a 32-bit signed integer.) Hmmm... I gues I have to do some stringformatting instead.
From: Peggy Schatz on 4 Oct 2007 10:30
Thanks to both of you! I just figured out the problem (as messju statet) when reading in the docs provided: Note: The valid range of a timestamp is typically from Fri, 13 Dec 1901 20:45:54 GMT to Tue, 19 Jan 2038 03:14:07 GMT. (These are the dates that correspond to the minimum and maximum values for a 32-bit signed integer.) Hmmm... I guess, I have to do some string formatting instead. |