Re: Confusing Date...

From: Date: Mon, 03 Mar 2003 21:44:47 +0000
Subject: Re: Confusing Date...
References: 1 2  Groups: php.db 
Request: Send a blank email to php-db+get-26073@lists.php.net to get a copy of this message
> 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/02 for 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 YYYY-MM-DD or YYYYMMDD 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...

« previous php.db (#26073) next »