Using system; using system.global;
Public class mainclass {public static void main (string [] args) {datetime dt = datetime.now; string [] format = {"d", "d", "f", "f", "g", "g "," M "," R "," S "," T "," T "," U "," U "," Y "," DDDD, MMMM DD YYYY "," DDD, MMM D / "' / "YY", "DDDD, MMMM DD", "M / YY", "DD-MM-YY",}; string date; for (int i = 0; i Format CharacterAssociated Property / DescriptiondShortDatePattern DLongDatePattern fFull date and time (long date and short time) FFullDateTimePattern (long date and long time) gGeneral (short date and short time) GGeneral (short date and long time) m, MMonthDayPattern r, RRFC1123Pattern sSortableDateTimePattern (based on ISO 8601) using local timetShortTimePattern TLongTimePattern uUniversalSortableDateTimePattern using the format for universal time displayUFull date and time (long date and long time) using universal timey, YYearMonthPatternThe following table lists the patterns that can be combined to construct custom patterns. The patterns are case- sensitive;.. for example, "mM" is recognized, but "mm" is not If the custom pattern contains white-space characters or characters enclosed in single quotation marks, the output string will also contain those characters characters not defined as part of A Format Pattern or as Format Characters Are Reproduces Litrally. Format PatternDescriptiondThe day of the month. Single-digit days will not have a leading zero.ddThe day of the month. Single-digit days will have a leading zero.dddThe abbreviated name of the day of the week, as defined in AbbreviatedDayNames.ddddThe full name of the day of the week, as defined in DayNames.MThe numeric month. Single-digit months will not have a leading zero.MMThe numeric month. Single-digit months will have a leading zero.MMMThe abbreviated name of the month, as defined in AbbreviatedMonthNames.MMMMThe full name of the month, as defined in MonthNames.yThe year without the century. If the year without the century is less than 10, the year is displayed with no leading zero.yyThe year without the century. If the year without the century is less than 10, the year is displayed with a leading zero.yyyyThe year in four digits, including the century.ggThe period or era. This pattern is ignored if the date to be formatted does not have an associated period ORA STRING.HTHE H Our IN A 12-Hour Clock. Single-Digit Hours Will NOT HAVE A Leading Zero.hhthe Hour in A 12-Hour Clock. Single-Digit Hours Will Have a Leading Zero.hthe Hour In A 24-Hour Clock. Single-Digit hours will not have a leading zero.HHThe hour in a 24-hour clock. Single-digit hours will have a leading zero.mThe minute. Single-digit minutes will not have a leading zero.mmThe minute. Single-digit minutes will have a leading zero.sThe second. Single-digit seconds will not have a leading zero.ssThe second. Single-digit seconds will have a leading zero.fThe fraction of a second in single-digit precision. The remaining digits are truncated.ffThe fraction Of a second in double-digit precision. The remaining digits are truncated.