how to display day from date using jquery

Posted by Klbaiju under jQuery on 3/14/2014 | Points: 10 | Views : 771 | Status : [Member] | Replies : 0
Hi,

I want to find the day from date using jquery.

in the below code alert is working fine as it displays number of day.

eg- saturday returns 0,sunday returns 6 etc.

My requirement is as follows.and this code is not working

if (date.getDay == "6") {

$(this).append("<a class='anchor2' >Saturday</a>");

}

$("#GridView1 tr td").filter(":not(td:first-child)").each(function () {

firstcelltext = $(this).parent().find("td:first-child").text();

var date = new Date(Date.parse(firstcelltext));
alert(date.getDay);
if (date.getDay == "6") {

$(this).append("<a class='anchor2' >Saturday</a>");

}

});

sample output

workingday 2500 2501 2502 2503 2504 2505 2506 2507
01 Jan 2014 NULL NULL NULL NULL NULL NULL NULL NULL
02 Jan 2014 NULL NULL NULL NULL NULL NULL NULL NULL
03 Jan 2014 NULL NULL NULL NULL NULL NULL NULL NULL
04 Jan 2014 NULL NULL NULL NULL NULL NULL NULL NULL
05 Jan 2014 NULL NULL NULL NULL NULL NULL NULL NULL
06 Jan 2014 NULL NULL NULL NULL NULL NULL NULL NULL
07 Jan 2014 NULL NULL NULL NULL NULL NULL NULL NULL
my require output should be january 2014 is saturday and that row should be saturday instead of null

how to solve this

Regards

Baiju




Responses

(No response found.)

Login to post response