Mega Code Archive

 
Categories / C# Tutorial / Date Time
 

DateTime Formatting

Format Character       Format Pattern                               Associated Property/ Description D                      MM/dd/yyyy                                   ShortDatePattern D                      dddd, MMMM dd, yyyy                          LongDatePattern F                      dddd, MMMM dd, yyyy HH:mm                    Full date and time  F                      dddd, MMMM dd, yyyy HH:mm:ss                 FullDateTimePattern G                      MM/dd/yyyy HH:mm                             General  G                      MM/dd/yyyy HH:mm:ss                          General  M, M                   MMMM dd                                      MonthDayPattern r, R                   ddd, dd MMM yyyy HH':'mm':'ss 'GMT'          RFC1123Pattern S                      yyyy-MM-dd HH:mm:ss                          SortableDateTimePattern using local time T                      HH:mm                                        ShortTimePattern T                      HH:mm:ss                                     LongTimePattern U                      yyyy-MM-dd HH:mm:ss                          UniversalSortableDateTimePattern using universal time U                      dddd, MMMM dd, yyyy HH:mm:ss                 UniversalSortableDateTimePattern y, Y                   MMMM, yyyy                                   YearMonthPattern