Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Globalization;
- namespace _16DistanceDays
- {
- class DistanceDays
- {
- static void Main(string[] args)
- {
- CultureInfo provider = CultureInfo.CurrentCulture;
- string format = "d.MM.yyyy";
- Console.Write("Enter the first date: ");
- string date1 = Console.ReadLine();
- DateTime firstDate = DateTime.ParseExact(date1, format, provider);
- Console.Write("Enter the second date: ");
- string date2 = Console.ReadLine();
- DateTime secondDate = DateTime.ParseExact(date2, format, provider);
- TimeSpan result = secondDate-firstDate;
- Console.WriteLine("Distance: {0} days",result.Days);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment