Date format issue while fetching data |
Date format issue while fetching data |
shankar from vizag |
May 14 2019, 09:33 AM
Post
#1
|
Advanced Member Group: Members Posts: 202 Joined: 18-June 13 Member No.: 19,316 |
Greetings
In my php page, I have used JQuery datepicker and it is working fine when the function as follows: <script> $("#myDatepicker").datepicker({dateFormat: 'yy-mm-dd'}); </script> But, I need the format as dd-mm-yy. When I tried to change the format as below, <script> $("#myDatepicker").datepicker({dateFormat: 'dd-mm-yy'}); </script> the date is saving in table as 0000-00-00. Kindly help me out to overcome this issue. regards |
CharlesEF |
May 21 2019, 10:26 AM
Post
#2
|
Programming Fanatic Group: Members Posts: 1,981 Joined: 27-April 13 From: Edinburg, Texas Member No.: 19,088 |
Before I pick this code apart, please post the PHP code that puts the date into the database. After you changed it to convert 'DD-MM-YYYY' into 'YYYY-MM-DD'.
Hint: You can't mix PHP commands with MySQL commands. Your 'SELECT' query does just that. date_format is a PHP command and you can't format a date that has not been retrieved (also, it is used incorrectly between double quotes). The select needs to return `sent_on` but you need to convert it in the 'while' loop. |
Lo-Fi Version | Time is now: 28th April 2024 - 11:39 AM |