There's gotta be an easier way to get create a date
properly formatted for MySQL's standard -MM-DD
DATE field format. Any suggestions,
smacks-upside-the-head, etc. on how to reduce this
would be greatly appreciated.
Here's my code:
?php
$today = getdate();
$year = $today['year'];
$month =
date(Y-m-d) should do the job
There's gotta be an easier way to get create a date
properly formatted for MySQL's standard -MM-DD
DATE field format. Any suggestions,
smacks-upside-the-head, etc. on how to reduce this
would be greatly appreciated.
--
Adam Rambousek
email: [EMAIL
PROTECTED]
Subject: [PHP] looong date formatting for MySQL
There's gotta be an easier way to get create a date
properly formatted for MySQL's standard -MM-DD
DATE field format. Any suggestions,
smacks-upside-the-head, etc. on how to reduce this
would be greatly appreciated.
Here's my code:
?php
NOW()
Jerry Lake
Interface Engineering Technician
-Original Message-
From: Adam Rambousek [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 17, 2001 4:20 PM
To: CGI GUY; [EMAIL PROTECTED]
Subject: Re: [PHP] looong date formatting for MySQL
date(Y-m-d) should do the job
There's gotta
Thanks for the reply, however, that function call
doesn't zero-substitute (i.e., 07 for 7, 03 for
3, etc.); that's why I've added this:
if ($month 10) {
$month = 0;
$month .= $today['mon'];
}
By default, MySQL only accepts dates as -MM-DD;
PHP's getdate(Y-m-d) prints out -M-DD or
formatting for MySQL
NOW()
Jerry Lake
Interface Engineering Technician
-Original Message-
From: Adam Rambousek [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 17, 2001 4:20 PM
To: CGI GUY; [EMAIL PROTECTED]
Subject: Re: [PHP] looong date formatting for MySQL
date(Y-m-d) should do
look into the docs, there's possibility to display zeros (but I don't remeber
exact letter)
Thanks for the reply, however, that function call
doesn't zero-substitute (i.e., 07 for 7, 03 for
3, etc.); that's why I've added this:
--
Adam Rambousek
email: [EMAIL PROTECTED] ICQ: 47596279
PROTECTED]]
Sent: Saturday, August 18, 2001 8:30 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] looong date formatting for MySQL
Thanks for the reply, however, that function call
doesn't zero-substitute (i.e., 07 for 7, 03 for
3, etc.); that's why I've added this:
if ($month 10) {
$month = 0;
$month
8 matches
Mail list logo