Re: how to use MYSQL date type string in php?
| From: | mydata | Date: | Thu, 20 Sep 2001 05:17:59 +0000 |
| Subject: | Re: how to use MYSQL date type string in php? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-67943@lists.php.net to get a copy of this message | ||
thank you very much
Could you offer me some available link about dealing datetime string in php?
"Rasmus Lerdorf" <rasmus@php.net> wrote in message
news:Pine.LNX.4.33.0109192137190.3022-100000@rasmus.php.net...
> > hi, I 'm new developer in php
> > I always need to get the date or time from mysql ,and dead it in php,but
I
> > found it defficult to deal mysql date type string in php. mysql date
type
> > string always like "yyyy-mm-dd",in php4.06 I can use strtotime fuction
> > convert it to unixtimestamp,but in php4.0 ,strtotime des not work.I
don't
> > know why?
> > And I want to know about how to deal date type string (speciall like
> > "yyyy-mm-dd") in php , and how to add days in date type string and so
> > on.Could you introduce me some good code sample or good link about deal
> > datetime in php.
>
> MySQL can do this work for you.
>
> ie. select UNIX_TIMESTAMP(column_name) from table ...
>
> There are also ways to add intervals and many other things directly in
> MySQL. However once you have it converted to a unix timestamp doing
> date-math in PHP is trivial in that you just add the appropriate number of
> seconds to the timestamp.
>
> Lots of info in the MySQL docs on this.
>
> -Rasmus
>