RE: [PHP-WIN] Bug in mktime-function ?
| From: | Ignatius Teo | Date: | Thu, 15 Feb 2001 02:29:41 +0000 |
| Subject: | RE: [PHP-WIN] Bug in mktime-function ? | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-5572@lists.php.net to get a copy of this message | ||
Is it me or I am the only one getting two copies of the same message?
Dirk, this as already answered by someone else on the list. mktime (according to the PHP manual)
"...returns the Unix timestamp corresponding to the arguments given. This timestamp is a long
integer containing the number of seconds between the Unix Epoch (January 1 1970) and the time
specified".
.."Year may be a two or four digit value, with values between 0-69 mapping to 2000-2069 and
70-99 to 1970-1999 (on systems where time_t is a 32bit signed integer, as most common today, the
valid range for year is somewhere between 1902 and 2037)."
Therefore any date on or before 1 Jan 1970 ain't going to work using mktime or any PHP function
which returns a UNIX timestamp.
You'll have to use substr ....:-(
Ignatius
> -----Original Message-----
> From: Dirk.Dinger@dignos.com [mailto:Dirk.Dinger@dignos.com]
> Sent: Thursday, 15 February 2001 03:30
> To: php-windows@lists.php.net
> Subject: [PHP-WIN] Bug in mktime-function ?
>
>
>
> Hello PHP-users,
>
> given the following code snippet to convert ISO-date-strings
> to localized
> date-strings:
>
> <?php
>
> $stringArray = explode("-", "1985-01-01");
> $month = $stringArray[1];
> $day = $stringArray[2];
> $year = $stringArray[0];
>
> $date = mktime(0,0,0,$month,$day,$year);
> $value = strftime("%d.%m.%Y", $date);
>
> echo $value;
> ?>
>
> This code works fine as long as I use dates after 1970, all earlier
> dates result in an empty value.
> According to the docs, mktime is supposed to work fine with 4-digit
> dates.
>
> What is the problem here...
>
> Greetings,
>
> Dirk
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net
> For additional commands, e-mail: php-windows-help@lists.php.net
> To contact the list administrators, e-mail:
> php-list-admin@lists.php.net
>