Re: easy date format question
| From: | Jim Lucas [php] | Date: | Sat, 02 Mar 2002 00:10:57 +0000 |
| Subject: | Re: easy date format question | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-17405@lists.php.net to get a copy of this message | ||
$today = date("Ymd");
$sql = "INSERT into table (date) values ('$today')";
when the $today variable is inserted into a mysql date column it will fit
just right.
but, if you want to insert it into a timestamp column, you will have to padd
it with 6 zero's
Jim Lucas
www.bend.com
----- Original Message -----
From: "Matthew Crouch" <whyyousee@yahoo.com>
To: <php-db@lists.php.net>
Sent: Friday, March 01, 2002 2:50 PM
Subject: [PHP-DB] easy date format question
> should be simple as pie, of course, but i can't find a straightforward
> syntax example in the documentation. i'm trying to change the PHP date
> format to mysql's.
>
> my code:
> $today = date("YYYYMMDD");
> $sql = "INSERT into table (date) values ('$today')";
> and so on...
>
> is filling the date field with zeros, instead of 2002-02-28
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>