Advertisement
Guest User

DifferenceBetweenDates

a guest
Apr 9th, 2014
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.61 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _4_DifferenceBetweenDates
  4. {
  5.     class Program
  6.     {
  7.         private static int CalculateDifferenceInDays(DateTime firstDate, DateTime secondDate)
  8.         {
  9.             TimeSpan difference = secondDate-firstDate;
  10.             return int.Parse(difference.TotalDays.ToString());
  11.         }
  12.  
  13.         static void Main(string[] args)
  14.         {
  15.             DateTime firstDate = DateTime.Parse(Console.ReadLine());
  16.             DateTime secondDate = DateTime.Parse(Console.ReadLine());
  17.  
  18.             Console.WriteLine(CalculateDifferenceInDays(firstDate, secondDate));
  19.         }
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement