Re: PHP date() and MySQL timestamp problem
| From: | Ignacio Vazquez-Abrams | Date: | Fri, 10 Nov 2000 17:50:43 +0000 |
| Subject: | Re: PHP date() and MySQL timestamp problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-24675@lists.php.net to get a copy of this message | ||
On Fri, 10 Nov 2000, Tom Harris wrote:
> Hi folks,
>
> I have another dumb newbie question (I'm sorry about the frequent posting,
> and appreciate all the answers greatly).
>
> I have a timestamp column in MySQL that I want to format into a normal date.
> The code I used was
>
> date ("d M Y", $modified)
> $modified is the value from the timestamp column. However it give a very
> wrong date. Anything I've modified today comes out as 18 Jan 2038.
>
> Any suggestion?
>
> Thanks,
>
> -T
>
You're doung it all wrong. The TIMESTAMP MySQL datatype has the format
"YmdHis" format (PHP date() format). You have to use substr() to break it
up first.
--
Ignacio Vazquez-Abrams <ignacio@openservices.net>