note 3876 modified in getdate by ronabop
| From: | ronabop@php.net | Date: | Fri, 20 Oct 2000 06:03:42 +0000 |
| Subject: | note 3876 modified in getdate by ronabop | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-6733@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);
http://www.php.net/manual/function.getdate.php