Custom Date & Time Format Strings
- 24 Jan 2022
- 1 Minute to read
-
Print
-
DarkLight
This documentation version is deprecated, please click here for the latest version.
Custom Date & Time Format Strings
- Updated on 24 Jan 2022
- 1 Minute to read
-
Print
-
DarkLight
Article summary
Did you find this summary helpful?
Thank you for your feedback
Overview
A DateTime format String provides properties and methods to format dates in different DateTime formats; the following table describes various date time formats and the outputs that will display to the end-user.
For more information, visit Custom Date and Time Format Strings.
Format | Output |
---|---|
DateTime.Now.ToString("MM/dd/yyyy") | 03/29/2021 |
DateTime.Now.ToString("dddd, dd MMMM yyyy") | Monday, 29 March 2021 |
DateTime.Now.ToString("dddd, dd MMMM yyyy") | Monday, 29 May 2021 05:50 |
DateTime.Now.ToString("dddd, dd MMMM yyyy") | |
DateTime.Now.ToString("dddd, dd MMMM yyyy") | Monday, 29 March 2021 5:50 |
DateTime.Now.ToString("dddd, dd MMMM yyyy") | Monday, 29 March 2021 5:50 AM |
DateTime.Now.ToString("dddd, dd MMMM yyyy HH:mm:ss") | Monday, 29 March 2021 05:50:06 |
DateTime.Now.ToString("MM/dd/yyyy HH:mm") | 03/29/2021 05:50 |
DateTime.Now.ToString("MM/dd/yyyy hh:mm tt") | 03/29/2021 05:50 AM |
DateTime.Now.ToString("MM/dd/yyyy H:mm") | 03/29/2021 5:50 |
DateTime.Now.ToString("MM/dd/yyyy h:mm tt") | 03/29/2021 5:50 AM |
DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss") | 03/29/2021 05:50:06 |
DateTime.Now.ToString("MMMM dd") | March 29 |
DateTime.Now.ToString("yyyy’-‘MM’-‘dd’T’HH’:’mm’:’ss.fffffffK") | 2021-03-29T05:50:06.7199222-04:00 |
DateTime.Now.ToString("ddd, dd MMM yyy HH’:’mm’:’ss ‘GMT’") | Mon, 29 March 2021 05:50:06 GMT |
DateTime.Now.ToString("yyyy’-‘MM’-‘dd’T’HH’:’mm’:’ss") | 2021-03-29T05:50:06 |
DateTime.Now.ToString("HH:mm") | 05:50 |
DateTime.Now.ToString("hh:mm tt") | 05:50 AM |
DateTime.Now.ToString("H:mm") | 5:50 |
DateTime.Now.ToString("h:mm tt") | 5:50 AM |
DateTime.Now.ToString("HH:mm:ss") | 05:50:06 |
DateTime.Now.ToString("yyyy MMMM") | 2021 March |
Was this article helpful?