Jump to content

Custom date format, to MySQL date


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
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 :(

Link to comment
Share on other sites

This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • 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.