how to check date in jquery

Posted by Klbaiju under jQuery on 7/17/2013 | Points: 10 | Views : 1337 | Status : [Member] | Replies : 3
Hi all,
I want to check date using jquery.
in grid view date display as dd mmm yyyy
eg

05 jul 2013
i want to check this date <= today
if it is less than or equal to today
i want to write some condition
i need code in jquery.


Regards
Baiju




Responses

Posted by: Jitendrasoft09 on: 7/20/2013 [Member] [MVP] Starter | Points: 25

Up
0
Down
Hi Baiju,

Look into below code for matching expected date with today date.

$(".date").datepicker();

$('#submitfloat').submit(function() {

var date = $('#PlannedDate').val();
var today= $('#CompletedDate').val();
if (Date.parse(date) <= Date.parse(today)) {
alert("condition")
}
return false;


});

Hope you are clear.

Jitendra Kumar
If my post helps you, plz mark as an answer.

Klbaiju, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Phagu007 on: 7/21/2013 [Member] Starter | Points: 25

Up
0
Down

You can use this for Checking date
var date = new Date(Date.parse("20 jul 2013"));
var today = new Date();
alert(date <= today );

Klbaiju, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: aswinialuri-19361 on: 7/21/2013 [Member] Starter | Points: 25

Up
0
Down
hi
refer this link it might be useful to you
http://stackoverflow.com/questions/11355811/to-check-input-string-is-valid-date-or-not-in-jquery

Mark as Answer if it helps you
Thanks&Regards
Aswini Aluri

Klbaiju, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response