Advertisement
Guest User

Untitled

a guest
Dec 31st, 2013
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.70 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace oraperc
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             DateTime[] datumok = { DateTime.Now, DateTime.Now.AddHours(8), DateTime.Now.AddSeconds(77) };
  14.             foreach (var item in datumok)
  15.             {
  16.                 Console.WriteLine(MyExtensions.oraperc(item));
  17.             }
  18.             Console.ReadKey();
  19.         }
  20.     }
  21.     static class MyExtensions
  22.     {
  23.         public static string oraperc(DateTime d)
  24.         {
  25.             return d.Hour.ToString("D2") + ":" + d.Minute.ToString("D2");
  26.         }
  27.     }
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement