Re: date(), strtotime(), Wed, Dec 31, 1969 ??
| From: | Philip Olson | Date: | Fri, 03 May 2002 16:33:35 +0000 |
| Subject: | Re: date(), strtotime(), Wed, Dec 31, 1969 ?? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-95917@lists.php.net to get a copy of this message | ||
Hi Robert-
You may want to spend a little more time
with basic PHP tutorials, see:
http://www.php.net/links
To answer your question, the problem is
with variable/string use, not any PHP
functions. $blah in particular.
Use quotes around strings:
$blah = '2002-05-02';
Read about strings:
http://uk.php.net/manual/en/language.types.string.php
http://www.zend.com/zend/tut/using-strings.php
As you are basically doing this:
$blah = 2002 - 5 - 2; // 1995
Anyway, also consider:
echo $thedate;
Although the behavoir of strtotime(1995) does seem
a little odd, in later versions of PHP it does try
to do something but not sure exactly what ... yet.
I'm assuming it returns -1 for you, in PHP3.
Regards,
Philip Olson
On Fri, 3 May 2002, ROBERT MCPEAK wrote:
> Running PHP3 on a Linux box and I've got trouble with date().
>
> Here's the code:
>
> $blah=2002-05-02;
> $thedate = date("D, M d, Y", strtotime($blah));
> $echo "$thedate";
>
>
> Why is $thedate resolving to Wed, Dec 31, 1969.
>
> Thanks!
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>