Jump to content

Custom date format, to MySQL date


Cine

Recommended Posts

Hi there,

 

I have a string '12/04/1990', that's in the format dd/mm/yyyy.

 

I'm attempting to convert that string to a Date, and then insert that date into a MySQL DATE field.

 

The problem is, every time I try to do so, I keep getting values like this in the database: 1970-01-01.

 

 

Any ideas?

 

 

Much appreciated.

 

 

Link to comment
https://forums.phpfreaks.com/topic/249715-custom-date-format-to-mysql-date/
Share on other sites

Show us some code and I'll take a look for you.

 

I currently have this: Date("Y-m-d", $this->dob);

 

...which outputs 1970-01-01 and is stored in the database.

 

I need a way of formatting that custom date string ($this->dob) into a format that MySQL can understand which is(Y-m-d).

 

But I don't know how :(

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.