Formatting Bootstrap 3 Datepicker for MySQL

372 views Asked by At

I'm using https://eonasdan.github.io/bootstrap-datetimepicker/ and there's a bit of a formatting issue.

When the format is set like this format: 'YYYY-MM-DD hh:mm', it looks nice for the user, as most people don't think in military time and understand AM/PM better. If 7:45AM (for example) is selected, $('#datepicker-data').val(); will return 07:45, but if 7:45PM is selected $('#datepicker-data').val(); will also return 07:45.

I'll be needing to insert the selected date and time into a MySQL database. Is there a way to get the user friendly input AND the MySQL friendly formatting for DB insert?

0

There are 0 answers