Click here to Skip to main content
15,899,126 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I'm using jQuery Datepicker for Selected Date & DropDownList for Selected Days(i.e. 7 to 15 days )
How to get the Required date which include selected date plus Selected Days
i.e Selected Date =25-Oct-2014 & Selected Days=10
Then Required Date=04-Nov-2014 Tuesday
I'm getting the result but I want result like "04-Nov-2014 Tuesday"
& I'm getting result "04-Nov-2014" like this,
So how to add Tuesday in the result

I'm using following code

C#
string result = DateTime.Now.Date.AddDays(10).ToString("dd-M-yy DD");
Posted
Updated 27-Oct-14 21:33pm
v6
Comments
Robert Welliever 28-Oct-14 3:40am    
Oh, you already had posted the answer. Why did you put it in comments?

To get the output like "04-Nov-2014 Tuesday" you need this code:
C#
string result = DateTime.Now.Date.AddDays(10).ToString("dd-MMM-yyyy dddd");
 
Share this answer
 
Put this line below it.
result = DateTime.Now.Date.AddDays(10).DayOfWeek + ", " + result;
 
Share this answer
 
You can use following code to find day.
then store it in a string and concatenate both you will get your result.

string result = DateTime.Now.Date.AddDays(10).ToString("dd-M-yy DD");
string day = result.DayOfWeek.ToString();

string date = day+result;
 
Share this answer
 
Comments
George Jonsson 28-Oct-14 5:03am    
A bit over-complicated.
Hi,

string result = DateTime.Now.Date.AddDays(10).ToString("dd-MMM-yyyy");
result = result + " " + Convert.ToDateTime(result).DayOfWeek.ToString();

Regards,
Fathima.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900