I’ve come across this best feature of C# (C sharp). If you need to specify Date Time in any custom format as your need then this feature will help you a lot.
Formatting DateTime in C#
Showing Date Time on user interface is sometimes so much important. There are also other scenarios where showing Date Time in a specified format is essential. The default date time setter i.e (DateTime.Now())’s format is not so user friendly sometimes. For this C#’s DateTime class gives some features. Below is a console application code that will show you how to get system’s date time in your own specific format.
Here is the output of above code.
Now you can change the date time format with your own specific needs.
1 thought on “Examples of Date Time Formatting in C#”
Date time formats are good in C# but handling them in different scenario are different. Im working on a project that is based on different time zones & basically tells you what time is in other corner of world. This will certainly be helpful in doing it.
Comments are closed.