Note that there are some explanatory texts on larger screens.

plurals
  1. POmysql dateformat with jquery date format not working out
    text
    copied!<p>I have a <code>mypage.php</code> and it contains the below code</p> <p>And i have added the</p> <pre><code>&lt;link style="text/css" href="http://jqueryui.com/themes/base/jquery.ui.all.css" rel="stylesheet"&gt; &lt;script type="text/javascript" src="/scripts/jquery.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="/scripts/ui/jquery.ui.core.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="/scripts/ui/jquery.ui.widget.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="/scripts/ui/jquery.ui.datepicker.js"&gt;&lt;/script&gt; &lt;form name="test_date" method="post"&gt; &lt;input type="text" id="datepicker1" name="date1"&gt; &lt;input type="submit" name="insert" value="Insert and show"&gt; &lt;/form&gt; </code></pre> <p>And In <code>jquery.ui.datepicker.js</code> i have change the date format to <code>dateFormat: 'dd/mm/yy'</code> from <code>dateFormat: 'mm/dd/yy'</code></p> <p>and below is the jquery for selecting the date when click on textbox </p> <pre><code>&lt;script&gt; $(function() { $( "#datepicker1" ).datepicker(); }); &lt;/script&gt; </code></pre> <p>And when i click on submit button i have inserted into mysql database database </p> <pre><code>&lt;?php if($_POST['insert']) { echo "Date : "; $d = $_POST['date1']; require('con_open.php'); $t = date('Y-m-j H:i:s', strtotime($d)); mysql_query("insert into date_table (date_field1) values ('$t')"); echo "Converted to Date at Runtime :" . $t; echo "&lt;br&gt;"; $query = mysql_query("select date_field1 from date_table"); while($r = mysql_fetch_row($query)) { got_date_db = $r[0]; } echo "Displaying date from Database : " . got_date_db; require('con_close.php'); } ?&gt; </code></pre> <p>Output :</p> <p><code>Converted to Date at Runtime : 2011-12-28 14:32:16</code></p> <p><code>Displaying date from Database : 0000-00-00 00:00:00</code></p> <p><code>date_field1 (DATETIME) fromat on mysql</code></p> <p>Even i have tried out checking with dateformat of mysql and php date function manuals online and over stackoverflow... but i could not get any solution to this one.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload