simeon3000

after30min

May 27th, 2017
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.31 KB | None | 0 0
  1.             int hour = int.Parse(Console.ReadLine());
  2.             int minute = int.Parse(Console.ReadLine());
  3.  
  4.             DateTime exactTime = DateTime.ParseExact($"{hour}:{minute}", "H:m", null);
  5.  
  6.             DateTime after30min = exactTime.AddMinutes(30);
  7.  
  8.             Console.WriteLine(after30min.ToString("H:mm"));
Advertisement
Add Comment
Please, Sign In to add comment