Parsing a date in jquery

In forms, I have two inputs for the date, StartDate input and input end date. I also have a date picker installed,

 $("#StartDate").datepicker();

datepicker formats it like this: 02/27/2013, which I don't like, but good.

I would like to parse the date before putting it in a serialized array. Is this a good aproach, and if so, how can I do it?

How to fulfill this end date inut more than Start That, and not allow sending oppsoite file

+5
source share
3 answers

Try the following:

 $.datepicker.parseDate('dd/mm/yy', '22/04/2010');

Link: http://docs.jquery.com/UI/Datepicker/parseDate

+4
source

, , , .

http://api.jqueryui.com/datepicker/#method-getDate

var currentDate = $( ".selector" ).datepicker( "getDate" );

+1

dateFormat, :

$("#StartDate").datepicker({ dateFormat: "yy-mm-dd" });

(Also see an example in jquery ui datepicker .)

And, as others have stated, you can use a utility function:

// Extract a date from a string value with a specified format.
$.datepicker.parseDate( format, value, settings )
0
source

All Articles