Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace dateAndTimeExercises
- {
- class Program
- {
- static void Main(string[] args)
- {
- DateTime date = DateTime.Now;
- string formatted1 = string.Format("{0:dd-MM-yyyy hh:mm:ss }", date);
- Console.WriteLine(formatted1);
- string formatted2 = string.Format("{0:dddd}"+ " of month " +"{0:MMMM}" + " year" + "{0: yyyy}", date);
- Console.WriteLine(formatted2);
- Console.WriteLine(string.Format("{0:'Day' dd}", date));
- Console.WriteLine(string.Format("Day {0:dddd }", date));
- Console.WriteLine(string.Format("Month {0:MMMM}", date));
- Console.WriteLine(string.Format("Year {0:yyyy}", date));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment