Re: Date function

From: Date: Fri, 19 Apr 2002 09:26:21 +0000
Subject: Re: Date function
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-93650@lists.php.net to get a copy of this message
MySQL (I assume that's the database you're inserting into) requires dates to be sent in YYYY-MM-DD format. You appear to be sending a unix timestamp. Try: date("Y-m-d",time()) // Sends a MySQL style date. or even: $SQL = "INSERT INTO orders (Customer_Id, Order_Date) VALUES($CustID,NOW())"; // uses MySQL's builtin date function to store the current date. HTH, Danny. ----- Original Message ----- From: "Alia Mikati" <Aliam@investcomholding.com> To: <php-general@lists.php.net> Sent: Friday, April 19, 2002 10:28 AM Subject: [PHP] Date function > Hello > I have the following SQL and I wanna insert the current date in one of > the table fields but it's not working. Can u tell me whats the problem? > (I'm using mysql and php) > Thx a lot > > $SQL = "INSERT INTO orders (Customer_Id, Order_Date)". > "VALUES($CustID,date())"; > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.general (#93650) next »