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

date_format Bug?

 
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 -> Bugs
View previous topic :: View next topic  
Author Message
cro4ky
Smarty Rookie


Joined: 14 Sep 2004
Posts: 5

PostPosted: Tue Sep 28, 2004 12:37 pm    Post subject: date_format Bug? Reply with quote

I saved a date (Birthday) in mysql as date (format: 0000-00-00).
It works fine for my personal birthday so i didn't notice this bug untill now. For a small forum i want to return the birthay. But when ther year is bevor 1970 it turns the date to 1970. It means 1900-1969 will not transform properly. Maybe it's a bug cuz the timestamp was start in the early 70s.

Maybe i'm wrong ... so here is my output...

<input type="text" maxlength="4" name="bd_year" value="{$user_optional.useropt_birthday|date_format:'%Y'}">
Back to top
View user's profile Send private message
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Tue Sep 28, 2004 2:21 pm    Post subject: Reply with quote

A feature, not a bug Smile

From: http://smarty.php.net/manual/en/language.modifier.date.format.php
Quote:
Programmers note: date_format is essentially a wrapper to PHP's strftime() function. You may have more or less conversion specifiers available depending on your system's strftime() function where PHP was compiled. Check your system's manpage for a full list of valid specifiers.


From: http://php.net/strftime
Quote:
Note: Not all conversion specifiers may be supported by your C library, in which case they will not be supported by PHP's strftime(). 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. %e, %T, %R and %D (there might be more) and dates prior to Jan 1, 1970 will not work on Windows, some Linux distributions, and a few other operating systems. For Windows systems a complete overview of supported conversion specifiers can be found at this MSDN website.


See Also: http://php.net/manual/en/function.mktime.php

The notes of mktime have a link to the adodb datetime library which overcomes this limitation. Other libraries are also available.
Back to top
View user's profile Send private message
cro4ky
Smarty Rookie


Joined: 14 Sep 2004
Posts: 5

PostPosted: Tue Sep 28, 2004 2:51 pm    Post subject: Reply with quote

Ah. 1000thx. The database querys will be updated in a few days with adodb. So it's no problem.

Thx again. Smile


//close
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 -> Bugs 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