note 3876 deleted from getdate by ronabop
| From: | ronabop@php.net | Date: | Sat, 10 Mar 2001 23:06:45 +0000 |
| Subject: | note 3876 deleted from getdate by ronabop | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-12223@lists.php.net to get a copy of this message | ||
Welp, while we're on the subject of examples with dates, I've had to shove the current
time/date into a mySQL datestamp using php3, and here's the code for that datestamp's
creation (hacked from the examples above, more or less):
$today = getdate();
$mon = $today[mon];
$mday = $today[mday];
$year = $today[year];
$minutes = $today[minutes];
if ( $minutes < 10) {
$minutes="0$minutes";
}
$hours = $today[hours];
printf("%s-%s-%s %s:%s:00", $year, $mon, $mday, $hours, $minutes);