Date Formatting in C# Aasim Naseem, June 15, 2010 Hello all. hope doing well … here is another tip related to C# programming …. i found it useful so sharing with you people … this is how you can format date in different format in asp.net / C# the usage is as follows <%= String.Format(“{specifier}”, DateTime.Now) %> where the possible specifiers are given below. Specifier Description Output d Short Date 15/05/2010 D Long Date 15 June 2010 t Short Time 21:08 T Long Time 21:08:59 f Full date and time 15 June 2010 21:08 F Full date and time (long) 15 June 2010 21:08:59 g Default date and time 15/06/2010 21:08 G Default date and time (long) 15/06/2010 21:08:59 M Day / Month 15 June r RFC1123 date Tue, 15 June 2010 21:08:59 GMT s Sortable date/time 2010-06-15 21:08:59 u Universal time, local timezone 2010-06-15 21:08:59Z Y Month / Year June 2010 dd Day 15 ddd Short Day Name Sun dddd Full Day Name Sunday hh 2 digit hour 09 HH 2 digit hour (24 hour) 21 mm 2 digit minute 08 MM Month 04 MMM Short Month name Jun MMMM Month name June ss seconds 59 tt AM/PM PM yy 2 digit year 07 yyyy 4 digit year 2010 : seperator, e.g. {0:hh:mm:ss} 09:08:59 / seperator, e.g. {0:dd/MM/yyyy} 15/06/2010 happy development 🙂 Please follow and like us: Aasim NaseemI’m an engineer by profession, a blogger and a photojournalist by hobby. Seasonal writer at LAFZ Media UK. I write on different topics and things around us. Contact me at +971.56.126.8842 or Aasim.Naseem@outlook.com Tips & Tutorials .NETASP.NetC#Date FormattingDate Formatting in C#