Re: Weird results for 2 lines of damn code
| From: | Curt Zirzow | Date: | Fri, 17 Oct 2003 01:40:54 +0000 |
| Subject: | Re: Weird results for 2 lines of damn code | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-166388@lists.php.net to get a copy of this message | ||
* Thus wrote Ryan A (ryan@coinpass.com):
> Hi everyone,
> This "very simple" program is driving me nuts, heres what i am doing:
> 1.making a timestamp with the current time.
> 2.reading from the timestamp and trying to "render" the date again
>
> $ryan=strtotime ("now"); echo $ryan."<br>";
> echo strftime( "%G-%m-%a %H:%M:%S", $ryan)."<br>";
You don't want to use %G for the year, there are cases where the
year will be wrong if you are using it with %m %a.
See the example 2 in strftime
http://php.net/strftime
use %Y instead.
Curt
--
"My PHP key is worn out"
PHP List stats since 1997:
http://zirzow.dyndns.org/html/mlists/