date format question
Moderator: General Moderators
date format question
ok...if i use the date format for a field in my database it stores as (YYYY-MM-DD) right? ok, now say if while filling out the form someone puts in December 30, 1973 or 12-30-1973 or simply 19731230(same day without dashes) will i get a db error?
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
lol, now that you know the answer to your question
lol, now that you know the answer to your question...
If the date isn't properly formatted, it will not be stored. You could try:
But the proper way to handle this issue is to simply force the formatting in the form itself. Instead of just giving a text field for the date, give a seperate dropdown for day, month, and year. Then just piece them together in your code.
PS. Hey feyd, you like my proper formatting? Uhu
If the date isn't properly formatted, it will not be stored. You could try:
Code: Select all
$formatted_date = date('Y-m-d', strtotime($raw_date) );PS. Hey feyd, you like my proper formatting? Uhu