Revision: 60091
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at October 20, 2012 04:56 by denakitan
Initial Code
// outputting today's date formatted as dd/mm/yyyy Console.WriteLine(DateTime.Now.ToString("dd/MM/yyyy")); // creating a DateTime object DateTime miyazakiBirthDate = new DateTime(1941, 1, 5); Console.WriteLine(miyazakiBirthDate.ToString("dd/MM/yyyy")); // example of DateTime arithmethic operation TimeSpan oneDay = new TimeSpan(1, 0, 0, 0); DateTime miyazakiBirthNextDay = miyazakiBirthDate + oneDay; Console.WriteLine(miyazakiBirthNextDay.ToString("dd/MM/yyyy")); // another way to output a formatted DateTime Console.WriteLine(string.Format("{0:MM/dd/yyy}", miyazakiBirthDate));
Initial URL
Initial Description
Basic examples on the usage of the DateTime objects.
Initial Title
.NET - C# - DateTime - Basics
Initial Tags
Net, c#
Initial Language
C#