currently all of the dates in my database are formatted like this:
2012-11-06 - so yyyy-mm-dd
but with my new date picker, they are saved like this
2012-06-11 - so yyyy-dd-mm
I need to some how change the way my date picker saves, as when they are converted into proper dates, the new ones are presented like:
2012-06-11 should be 6th November 2012, but instead it comes up as 11th June 2012..
I'm using jQuery, this is how it's installed:
%script{:src => "http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js", :type => "text/javascript"}
%link{:href => "http://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css", :rel => "stylesheet"}/
%script{:src => "http://code.jquery.com/jquery-1.8.2.js"}
%script{:src => "http://code.jquery.com/ui/1.9.1/jquery-ui.js"}
%link{:href => "/resources/demos/style.css", :rel => "stylesheet"}/
:javascript
$(function() {
$( "#datepicker" ).datepicker();
$( "#format" ).change(function() {
$( "#datepicker" ).datepicker( "option", "dateFormat", $( this ).val() );
});
});
is there something that I could put in the "dateFormat" bit that could change this??
Update The column type in the database is "timestamp" could that change anything?
Ended up using this:
$("input[name=dateposted]").datepicker({ dateFormat: "yy-mm-dd" });