note 4513 modified in getdate by ronabop
| From: | ronabop@php.net | Date: | Fri, 20 Oct 2000 06:04:51 +0000 |
| Subject: | note 4513 modified in getdate by ronabop | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-6735@lists.php.net to get a copy of this message | ||
Inserting date/time values into MySQL does NOT require 10 lines of code for
each date. Just use the "date" function here in PHP to make a MySQL-friendly
field:
$startdate=date('Y-m-d');
Use the optional second argument to specify the time (other than "now")
to be inserted. If you want to insert
into a date/time field, use the
following:
$enddatetime=date('Y-m-d H:i:s');
Again, use the second argument to specify an exact time.
http://www.php.net/manual/function.getdate.php