This is a short tutorial on how to add days to a given date using C#.
Are you want to add days to date? Here is the solution to add days to the current date or desired date using C#.
Using the DateTime class to add days to a date
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
class Program { static void Main(string[] args) { Console.WriteLine("How to Add 7 Days to Current Date in C#"); DateTime date = DateTime.Now; DateTime arrivalDate = date.AddDays(7); //add seven days Console.WriteLine("NOW:{0} Arrival Date:{1}", date, arrivalDate); Console.ReadLine(); } } |