Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Problem with date format

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
sotskiy
Smarty n00b


Joined: 26 Feb 2004
Posts: 2

PostPosted: Thu Feb 26, 2004 1:58 pm    Post subject: Problem with date format Reply with quote

For some reason all dates early 1 Jan 1970 shown incorrect.

For example I have next code:
Code:
{$birthDay|date_format}

if $birthDay date more then 1 Jan 1970 everything works fine but if early I recieve 1 Jan 1970 as output.

I found that PHP function strtotime used for date validation and it's return "-1"

Does anybody know what I should do?

Thanks in advance.


Last edited by sotskiy on Wed May 05, 2010 11:02 pm; edited 1 time in total
Back to top
View user's profile Send private message
sotskiy
Smarty n00b


Joined: 26 Feb 2004
Posts: 2

PostPosted: Fri Feb 27, 2004 2:02 pm    Post subject: Any ideas? Reply with quote

Does anyone have similar errors or I'm the one?

Can anybody help me.

Thanks


Last edited by sotskiy on Wed May 05, 2010 11:02 pm; edited 1 time in total
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Fri Feb 27, 2004 2:30 pm    Post subject: Reply with quote

date_format uses strftime which has this limitation (and I think date has it too). It wouldn't be too difficult to create a function that uses Date_Calc from PEAR, or extend date_format to use it.

http://pear.php.net/package/Date
Back to top
View user's profile Send private message Visit poster's website
Duncan
Smarty Pro


Joined: 16 Dec 2003
Posts: 166

PostPosted: Fri Feb 27, 2004 2:45 pm    Post subject: Reply with quote

From the php manual: http://de2.php.net/manual/en/function.strtotime.php

Quote:
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.) Additionally, not all platforms support negative timestamps, therefore your date range may be limited to no earlier than the Unix epoch. This means that e.g. dates prior to Jan 1, 1970 will not work on Windows, some Linux distributions, and a few other operating systems.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP