i want to add my variable $ar_dob to my sql database .
it work for me but i want to my insert time to sql databse and i pick with date by jquery ui calender
The reason I ask: If the value from the datapicker is in the format "mm/dd/yyyy" or "dd/mm/yyyy" then it won't work with MySQL. MySQL requires format "yyyy-mm-dd". So you need to either re-format the date in your PHP code or use a MySQL function that will convert from the wrong format to the right one.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
The reason I ask: If the value from the datapicker is in the format "mm/dd/yyyy" or "dd/mm/yyyy" then it won't work with MySQL. MySQL requires format "yyyy-mm-dd". So you need to either re-format the date in your PHP code or use a MySQL function that will convert from the wrong format to the right one.
yes, My Datetimepicker format is mm/dd/yy from jquery ui site
and my mysql date format is yyyy-mm-dd so, i can't insert
So,How to reformat the date or how to change sql format
Guess you didn't mean "time". The default for Datepicker is "mm/dd/yy", but you can change that. See How to initialize the datepicker with the dateFormat option specified:
Thanks mate ,now i see how to format the date for your kindness
and i just have one question about the time
can i formate the time like this 9:00 AM to 10:35 PM
Really thanks sunfighter
Those are the same format. 9:00 AM = 10:35 PM when it comes to the display format. MySQL uses a 24 hour clock, so display wise you can use PHP to interpret it as you see fit. Since you are using a datetime type in MySQL, php can take that an convert it easily with the datetime class.
PHP Code:
$dt = new DateTime($record['datetime']);
print $dt->format('F j Y g:i A'); // January 5 2013 12:27 PM