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 16 2019, 12:32 AM
Post
#2
|
Programming Fanatic Group: Members Posts: 1,981 Joined: 27-April 13 From: Edinburg, Texas Member No.: 19,088 |
The jQuery site provides a working example, found here. While it doesn't have 'dd-mm-yy' as an option you should be able to 'View source' and look at the javascript to figure out how it works. Also, load all your javascript in the <head>...</head> section.
I just played with the datepicker example and found 'dd-mm-yy' will display '16-05-2019' while 'dd-mm-y' will display '16-05-19'. So, this code should work: CODE <!doctype html> <html> <head> <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css"> <link rel="stylesheet" href="w3.css"> <link rel="stylesheet" href="js/jquery-ui/jquery-ui.min.css"> <script src="js/bootstrap.min.js"></script> <script src = "js/jquery.js"></script> <script src = "js/jquery-ui/jquery-ui.js"></script> </head> <body> Enter Date: <input type = "text" id="datepicker"> <script> $('#datepicker').datepicker({ dateFormat: 'dd-mm-yy' }); </script> </body> </html> This post has been edited by CharlesEF: May 16 2019, 12:47 AM |
Lo-Fi Version | Time is now: 26th April 2024 - 12:37 AM |