note 4513 deleted from function.getdate by tomsommer
| From: | tomsommer@php.net | Date: | Wed, 15 Sep 2004 16:37:49 +0000 |
| Subject: | note 4513 deleted from function.getdate by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-76755@lists.php.net to get a copy of this message | ||
Note Submitter: mdchaney at michaelchaney dot com
----
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.