
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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
- Related Questions & Answers
- Add 11 days to current date in MySQL
- MySQL Datetime to add days?
- Java Program to add days to current date using Java Calendar
- MySQL add days to a date?
- How to subtract 10 days from the current datetime in MySQL?
- How to subtract 30 days from the current datetime in MySQL?
- MySQL query to get current datetime and only current date
- How to add days to $Date in PHP?
- How to add number of days to JavaScript Date?
- Get the number of days between current date and date field?
- Insert current date in datetime format MySQL?
- Java Program to get date for all the days of the current week
- MySQL query to fetch date records greater than the current date after adding days with INTERVAL?
- Add 30 days to date in a MySQL table with arrival date records
- Subtract days from current date using Calendar.DATE in Java
Advertisements