Advertisement
Guest User

Untitled

a guest
Apr 17th, 2014
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. static void runTimeConverter()
  2. {
  3. double arrivalTime;
  4. arrivalTime = getArrivalTime();
  5. string time = DateTime.ParseExact(arrivalTime, "HHmm", CultureInfo.CurrentCulture)
  6. .ToString("hh:mm tt");
  7. Console.WriteLine("Equals " + time);
  8. }
  9.  
  10. static double getArrivalTime()
  11.  
  12. {
  13. Console.WriteLine
  14. ("Enter time in 24 hour format to convert to 12hour");
  15. string timeSelected = Console.ReadLine();
  16. int timeInput = int.Parse(timeSelected);
  17. return timeInput;
  18. }
  19.  
  20. using System.Globalization;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement