RE: [PHP-DB] Confusing Date...
Doug, Here's an example of how to format the date: $date = "3/2/2003"; $good_date= date("Y-m-d", strtotime($date)); -- Beverly Steiner [EMAIL PROTECTED] -Original Message- From: Doug Coning [mailto:[EMAIL PROTECTED] Sent: Monday, March 03, 2003 5:38 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Confusing Date... Yes, but not too many people are familiar with enter the year first, followed by the month then the date. Is there a way within PHP to take 03/02/2002 and send it as 2003-03-02. Thanks, Doug Coning - Original Message - From: "Beverly Steiner" <[EMAIL PROTECTED]> To: "Doug Coning" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Monday, March 03, 2003 3:35 PM Subject: RE: [PHP-DB] Confusing Date... > Doug, > > I know it works if you send the date as -mm-dd. For example yesterday, > March 2, 2003 would be 2003-03-02 > > -- > Beverly Steiner > [EMAIL PROTECTED] > > > -Original Message- > From: Doug Coning [mailto:[EMAIL PROTECTED] > Sent: Monday, March 03, 2003 5:29 PM > To: [EMAIL PROTECTED] > Subject: [PHP-DB] Confusing Date... > > > I have a MySQL column that was set to date. > > In my PHP page, I have a form and a field called 'Sch_StartDate'. I'm > having difficultes understanding how to write to the date column in MySQL. > If I send 03/04/02for March 4, 2002, the value that gets stored in the > MySQL database is 2003-04-02 for April 2nd, 2003. > > The field is set to to send as a date: > GetSQLValueString($HTTP_POST_VARS['Sch_StartDate'], "date") > > So how do I send dates to MySQL so that it stores it correctly? > > Thank you!! > > Confused, > > Doug > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Confusing Date...
> I have a MySQL column that was set to date. > > In my PHP page, I have a form and a field called 'Sch_StartDate'. I'm > having difficultes understanding how to write to the date column in MySQL. > If I send 03/04/02for March 4, 2002, the value that gets stored in the > MySQL database is 2003-04-02 for April 2nd, 2003. > > The field is set to to send as a date: > GetSQLValueString($HTTP_POST_VARS['Sch_StartDate'], "date") > > So how do I send dates to MySQL so that it stores it correctly? MySQL expects the date in a -MM-DD or MMDD format. You can actually use other characters as the delimiter instead of the dash (-) character, as long as the year, month, and day are in the right order. As you've seen, you can also pass it a two digit year and it'll assume what century you mean. ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Confusing Date...
Doug, I know it works if you send the date as -mm-dd. For example yesterday, March 2, 2003 would be 2003-03-02 -- Beverly Steiner [EMAIL PROTECTED] -Original Message- From: Doug Coning [mailto:[EMAIL PROTECTED] Sent: Monday, March 03, 2003 5:29 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Confusing Date... I have a MySQL column that was set to date. In my PHP page, I have a form and a field called 'Sch_StartDate'. I'm having difficultes understanding how to write to the date column in MySQL. If I send 03/04/02for March 4, 2002, the value that gets stored in the MySQL database is 2003-04-02 for April 2nd, 2003. The field is set to to send as a date: GetSQLValueString($HTTP_POST_VARS['Sch_StartDate'], "date") So how do I send dates to MySQL so that it stores it correctly? Thank you!! Confused, Doug -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php