Saving date in mysql db
I have a form which includes text field.
I want to enter there a date like: 22/05/2014 (something like: date("d.m.Y",$x);)
and the information will be saved in a mysql database.
I don't know how to do it correctly since all the time the db returns be the date 31.12.1969
I'll appreciate your help!
You should be using timestamps because they're a more accurate way to store dates. What's happening here is that you're actually already using timestamps somehow, and your (invalid timestap) input is being converted to the first possible date in timestamps, which is the end of 1969-- timestamps start in 1970, because dates before then are rarely relevant to computers.
What format do you want to use? If not timestamps, why not?
Are all parts of your system configured for that type of format?
I want to write a date in the future and I don't know how to convert it into timestamp
Do you want to use timestamps? Is your database configured for timestamps? Is the rest of the script configured for that?
I'm still not sure exactly what the problem is.
Are you looking for a way to create a timestamp? The answer is probably the strtotime() function: