C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » JavaScript »

How to find date within a given range using javascript


Posted Date: 30 Oct 2009      Posted By: Hygeena      Member Level: Gold     Points: 1   Responses: 5



I want to got dates within a given range using javascript

for eg: 12-oct-2009 to 15-oct-2009

result should be 13-oct-2009,14-oct-2009

also i want to take day from that and find dayname also.

any idea!!!





Responses

Author: satya    30 Oct 2009Member Level: DiamondRating: 4 out of 54 out of 54 out of 54 out of 5     Points: 6

to find the day name using javascript:

<script language="javascript" type="text/javascript" >
var vDate = new Date(); //09/01/2009"
alert( d.getUTCDay());
var day_name=new Array(7);
day_name[0]="Sunday"
day_name[1]="Monday"
day_name[2]="Tuesday"
day_name[3]="Wednesday"
day_name[4]="Thursday"
day_name[5]="Friday"
day_name[6]="Saturday"

alert ("Today Day is = " + day_name[vDate.getDay()]);

</script>



Author: Hygeena    30 Oct 2009Member Level: GoldRating: 2 out of 52 out of 5     Points: 2

thank u satya.but i want to find dates between two ranges.how can i do that.plz.


Author: Hygeena    30 Oct 2009Member Level: GoldRating: 2 out of 52 out of 5     Points: 2

my actual requirement is

i have 7 buttons sunday monday tuesday etc....

i want to change the forecolor of those buttons that will come within the selected range.

how to do this using javascript



Author: Gaurav Arora    30 Oct 2009Member Level: DiamondRating: 3 out of 53 out of 53 out of 5     Points: 3

You can do this using Javascript too

in addition to Satya's code, I am writting the folowing code:


function Elementcolor()
{
<elementid>.style.color = <your color>;
}


Change elementId with your id and your color with your choice of color.

Add this code where you want the change of color



Thanks & regards,
Gaurav Arora - Sr. Editor
Me in My Own Style



Author: nallamani    30 Oct 2009Member Level: BronzeRating: 2 out of 52 out of 5     Points: 2

var myDate=new Date();
myDate.setFullYear(2009,10,12);
var today = new Date();
today.setFullYear(2009,10,15);
var betweendate=myDate.getDate()+3



Post Reply
You must Sign In to post a response.
Next : Javascript how to make the dropdown value to reset to intiall value(checking the check box
Previous : How to enter only numeric values in textbox
Return to Discussion Forum
Post New Message
Category: JavaScript

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use