- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
C# DateTime to add days to the current date
Firstly, get the current date.
DateTime.Today
Now, use AddDays() method to add days to the current date. Here, we are adding 10 days to the current date.
DateTime.Today.AddDays(10)
Let us see the complete code −
Example
using System; using System.Linq; public class Demo { public static void Main() { Console.WriteLine("Today = {0}", DateTime.Today); Console.WriteLine("Add 10 Days = {0}", DateTime.Today.AddDays(10)); } }
Output
Today = 9/11/2018 12:00:00 AM Add 10 Days = 9/21/2018 12:00:00 AM
Advertisements