I am using datepicker in my form for booking date field. when i pick a date it shown like this 11/13/2013 (MM/DD/YYYY). In mysql database i am using datetime Type. in mysql db always shows 0000-00-00 00:00:00. i want to change the date format. for example if i am choose today date like this (11/13/2013) it should stored in mysql db like this (13-11-2013) with current time. how to change the date format permanently in mysql? i know NOW() stored the current time in mysql. but how can i integrate with datepicker??
Indians
0
Junior Poster in Training
Recommended Answers
Jump to Postyou can use datepicker's formatDate function:
var dateTypeVar = $('#datepicker').datepicker('getDate'); $.datepicker.formatDate('dd-mm-yy', dateTypeVar);
or you can also do that
<script type="text/javascript"> $(function() { $("#datepicker").datepicker({ dateFormat: "yy-mm-dd" }).val() }); </script>
now you have to insert this value in mysql i hope you know how …
Jump to PostYou have 3 main options (possibly more)
- Use a different format in your datepicker (as mentioned above)
- Get php to transform it.
- Transform it with MySQL.
If you can't do (1) then go with (2):
$Ymd = date('Y-m-d', strtotime($picker));
WRT datepicker - is this the …
All 5 Replies
AARTI SHRIVAS
2
Posting Pro in Training
AARTI SHRIVAS
2
Posting Pro in Training

diafol
Indians
0
Junior Poster in Training

diafol
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.