Starting Date : 10/7/2010 12:00:00 AM Ending Date : 10/17/2010 12:00:00 AM
Users Online
· Guests Online: 139
· Members Online: 0
· Total Members: 188
· Newest Member: meenachowdary055
· Members Online: 0
· Total Members: 188
· Newest Member: meenachowdary055
Forum Threads
Newest Threads
No Threads created
Hottest Threads
No Threads created
Latest Articles
Articles Hierarchy
C# Program to Add Two Dates
C# Program to Add Two Dates
This is a C# Program to add two dates.
Problem Description
This C# Program Adds Two Dates.
Problem Solution
Here the new date is found by adding using function AddDays().
Program/Source Code
Here is source code of the C# Program to Add Two Dates . The C# program is successfully compiled and executed with Microsoft Visual Studio. The program output is also shown below.
/* * C# Program to Add Two Dates */ using System; namespace DateAndTime { class Program { static int Main() { DateTime SDate = new DateTime(2010, 10, 7); Console.WriteLine("Starting Date : {0}", SDate); DateTime EDate = startDate.AddDays(10); Console.WriteLine("Ending Date : {0}\n", EDate); Console.ReadLine(); return 0; } } }
Program Explanation
This C# program is used to add two dates. DateTime, is a structure that is available from the System namespace within the base class libraries. This structure has a static method called ‘Now’ that returns the current time. There are a large number of additional data members and methods within the DateTime structure. Here the new date is found by adding using function AddDays().
Runtime Test Cases
Comments
No Comments have been Posted.
Post Comment
Please Login to Post a Comment.