The following table lists the custom date and time format specifiers:
| d | It is used to represent a day of a month as a number from 1 to 31. It is used to format a single digit day without a leading zero. |
| dd | It is used to represent a day of a month as a number from 01 to 31. It is used to format a single-digit day with a leading zero. |
| ddd | It is used to represent a abbreviated name of a day of the week as defined in the current DateTimeFormatInfo.AbbreviatedDayNames property. |
| dddd (plus any number of additional d specifiers) | It is used to represent a full name of a day of the week as defined in the current DateTimeFormatInfo.DayNames property. |
| f | It is used to represent the most significant digit of the seconds fraction. If the f format specifier is used without other format specifiers, it is interpreted as the f standard date and time format specifier. |
| ff | It is used to represent the two most significant digits of the seconds fraction. |
| fff | It is used to represent the three most significant digits of the seconds fraction. |
| ffff | It is used to represent the four most significant digits of the seconds fraction. |
| fffff | It is used to represent the five most significant digits of the seconds fraction. |
| ffffff | It is used to represent the six most significant digits of the seconds fraction. |
| fffffff | It is used to represent the seven most significant digits of the seconds fraction. |
| F | It is used to represent the most significant digit of the seconds fraction. Nothing is displayed if the digit is zero. |
| FF | It is used to represent the two most significant digits of the seconds fraction. However, trailing zeros or two zero digits are not displayed. |
| FFF | It is used to represent the three most significant digits of the seconds fraction. However, trailing zeros or three zero digits are not displayed. |
| FFFF | It is used to represent the four most significant digits of the seconds fraction. However, trailing zeros or four zero digits are not displayed. |
| FFFFF | It is used to represent the five most significant digits of the seconds fraction. However, trailing zeros or five zero digits are not displayed. |
| FFFFFF | It is used to represent the six most significant digits of the seconds fraction. However, trailing zeros or six zero digits are not displayed. |
| FFFFFFF | It is used to represent the seven most significant digits of the seconds fraction. However, trailing zeros or seven zero digits are not displayed. |
| g, gg (plus any number of additional g specifiers) | It is used to represent the period or era, for example, A.D. Formatting ignores this specifier if the date to be formatted does not have an associated period or era string. |
| h | It is used to represent the hour as a number from 1 to 12. A particular hour after midnight is indistinguishable from the same hour after noon. The hour is not rounded, and a single-digit hour is formatted without a leading zero. |
| hh, hh (plus any number of additional h specifiers) | It is used to represent the hour as a number from 01 to 12. A particular hour after midnight is indistinguishable from the same hour after noon. The hour is not rounded, and a single-digit hour is formatted with a leading zero. |
| H | It is used to represent the hour as a number from 0 to 23. A single-digit hour is formatted without a leading zero. |
| HH, HH (plus any number of additional H specifiers) | It is used to represent the hour as a number from 00 to 23. A single-digit hour is formatted with a leading zero. |
| K | It is used to represent the time zone information of a date and time value. When used with DateTime values, the result string is defined by the value of the DateTime.Kind property. This specifier is equivalent to the zzz specifier and produces a result string containing the local offset from Coordinated Universal Time (UTC). |
| m | It is used to represent the minute as a number from 0 to 59. The minute represents whole minutes that have passed since the last hour. A single-digit minute is formatted without a leading zero. |
| mm, mm (plus any number of additional m | It is used to represent the minute as a number from 00 to 59. The minute represents whole minutes that have passed since the last hour. A single-digit minute is formatted with a leading zero. |
| M | It is used to represent the month as a number from 1 to 12. A single-digit month is formatted without a leading zero. |
| MM | It is used to represent the month as a number from 01 to 12. A single-digit month is formatted with a leading zero. |
| MMM | It is used to represent the abbreviated name of the month as defined in the current DateTimeFormatInfo.AbbreviatedMonthNames property. |
| MMMM | It is used to represent the full name of the month as defined in the current DateTimeFormatInfo.MonthNames property. |
| s | It is used to represent the seconds as a number from 0 to 59. The result represents whole seconds that have passed since the last minute. A single-digit second is formatted without a leading zero. |
| ss, ss (plus any number of additional s specifiers) | It is used to represent the seconds as a number from 00 to 59. The result represents whole seconds that have passed since the last minute. A single-digit second is formatted with a leading zero. |
| t | It is used to represent the first character of the AM/PM designator defined in the current DateTimeFormatInfo.AMDesignator or DateTimeFormatInfo.PMDesignator property. |
| tt, tt (plus any number of additional t specifiers) | It is used to represent the AM/PM designator as defined in the current DateTimeFormatInfo.AMDesignator or DateTimeFormatInfo.PMDesignator property. The AM designator is used if the hour in the time being formatted is less than 12. Otherwise, the PM designator is used. |
| y | It is used to represent the year as a one or two-digit number. If the year has more than two digits, only the two low-order digits appear in the result and rest of the digits will be discarded. If the first digit of a two-digit year begins with a zero (for example, 2010), the number is formatted without a leading zero. |
| yy | It is used to represent the year as a two-digit number. If the year has more than two digits, only the two low-order digits appear in the result and rest of the digits will be discarded. If the two-digit year has fewer than two significant digits, the number is padded with leading zeros to achieve two digits. |
| yyy | It is used to represent the year with a minimum of three digits. If the year has more than three significant digits, they are included in the result string. If the year has fewer than three digits, the number is padded with leading zeros to achieve three digits. |
| yyyy | It is used to represent the year as a four-digit number. If the year has more than four digits, only the four low-order digits appear in the result and rest of the digits will be discarded. If the year has fewer than four digits, the number is padded with leading zeros to achieve four digits. |
| yyyyy (plus any number of additional y specifiers) | It is used to represent the year as a five-digit number. If the year has more than five digits, only the five low-order digits appear in the result and rest of the digits will be discarded. If the year has fewer than five digits, the number is padded with leading zeroes to achieve five digits. |
| z | It is used to represent the signed offset of the local operating system’s time zone from Coordinated Universal Time (UTC), measured in hours. It does not reflect the value of an instance’s Kind property. For this reason, the any z format specifier is not suggested to use with DateTime values. |
| zz | It is used to represent the signed offset of the local operating system’s time zone from UTC, measured in hours. |
| zzz, zzz (plus any number of additional z specifiers) | It is used to represents the signed offset of the local operating system’s time zone from UTC, measured in hours and minutes. |
| : | It is used to represent the time separator defined in the current DateTimeFormatInfo.TimeSeparator property. |
| / | It is used to represent the date separator defined in the current DateTimeFormatInfo.DateSeparator property. It is used to differentiate years, months, and days. |
| ” | It is used to represent a quoted string (quotation mark). It is used to display the literal value of any string between two quotation marks (”). An application should precede each quotation mark with an escape character (). |
| ‘ | It is used to represent a quoted string (apostrophe). It is used to display the literal value of any string between two apostrophe (’) characters. |
| % | It is used to represent the result associated with a c custom format specifier. If a user wants to use the d, f, F, h, m, s, t, y, z, H, or M custom format specifier by itself, an application should specify %d, %f, %F, %h, %m, %s, %t, %y, %z, %H, or %M. |
| c | It is used to represent the escape character, and displays the character “c” as a literal when that character is preceded by the escape character (). |
- Best exam simulation Microsoft mcp download free trial.
- Become Microsoft MCPD certified.
- Download free practice test for mcpd-net-2-0-enterprise-developer MCPD .NET 2.0 Enterprise developer exam.
- Download practice question and study guide for mcpd-net-2-0-web-developer for exam.
- Download practice question and study guide for mcpd-net-2-0-windows-developer for exam.
- Click here to get free mcpd-enterprise-applications-developer MCPD Enterprise Applications Developer exam practice questions.
- Click here to download mcpd-web-developer test study guide and practice question.
- Download practice question and study guide for mcpd-windows-developer for exam.
- Click here to get free mcts-net-2-0 MCTS .NET 2.0 exam practice questions.
- Pass Microsoft mcts-net-2-0-distributed-applications - MCTS .NET Distributed
- Become Microsoft MCTS .NET Web certified.
- Download free practice test for mcts-net-2-0-windows-applications MCTS .NET Windows exam.
- Pass MCTS Microsoft Visual Studio 2008 in first attampt.
- Become Microsoft C# .NET Framework Application Development Foundation certified.
- Best exam simulation Microsoft 70-536-VB download free trial.
Like this article? Share it with others
If you like this article, please leave a comment or subscribe this blog via RSS or via e-mail, Bookmark and share through your network. Click the AddThis button below. Thanks.
If you like this article, please leave a comment or subscribe this blog via RSS or via e-mail, Bookmark and share through your network. Click the AddThis button below. Thanks.
