Jump to content

PHP Date() returns 0000


pedrosorio

Recommended Posts

Are you echoing $data and getting that return value?

 

Ok, you got me =X

 

"2009-Sep-Wed" appears if I echo, I am inserting a record into a MySQL database. The field I'm inserting this into has type DATE.

 

INSERT INTO Users VALUES ('$nome','$pass','$number','$data')

It's realising it's an invalid date and adding the default value. What you want is this.

 

date_default_timezone_set("Europe/Lisbon");
$data=date("Y-m-d");

 

I've tried changing the date format and achieved that result just before reading your post =) Thanks!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.