Advertisement
svetlozar_kirkov

Date Parsing and Adding (Exercise)

Oct 11th, 2014
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.45 KB | None | 0 0
  1. using System;
  2. using System.Globalization;
  3.  
  4. namespace ConsoleTests
  5. {
  6.     class ConsoleTests
  7.     {
  8.         static void Main()
  9.         {
  10.             string input = Console.ReadLine();
  11.             DateTime date = DateTime.ParseExact(input, "dd.MM.yyyy H:mm:ss", CultureInfo.CurrentCulture);
  12.             date = date.AddHours(6);
  13.             date = date.AddMinutes(30);
  14.             Console.WriteLine(date.ToString("dd.MM.yyyy H:mm:ss"));
  15.         }
  16.     }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement