Saviaa

Untitled

Jun 20th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.72 KB | None | 0 0
  1. namespace dateAndTimeExercises
  2. {
  3.     class Program
  4.     {
  5.         static void Main(string[] args)
  6.         {
  7.             DateTime date = DateTime.Now;
  8.             string formatted1 = string.Format("{0:dd-MM-yyyy hh:mm:ss }", date);
  9.             Console.WriteLine(formatted1);
  10.             string formatted2 = string.Format("{0:dddd}"+ " of month " +"{0:MMMM}" + " year" + "{0: yyyy}", date);
  11.             Console.WriteLine(formatted2);
  12.             Console.WriteLine(string.Format("{0:'Day' dd}", date));
  13.             Console.WriteLine(string.Format("Day {0:dddd }", date));
  14.             Console.WriteLine(string.Format("Month {0:MMMM}", date));
  15.             Console.WriteLine(string.Format("Year {0:yyyy}", date));
  16.         }
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment