Date
-
I wanted to display todays date in dd-mmm-yy fromat. can anybody help me please.(Asp/c#) Ak
Hi Here is an example for displaying date in any format:
DateTime DtmDate = DateTime.Now;
System.Globalization.DateTimeFormatInfo dfi = new System.Globalization.DateTimeFormatInfo();
dfi.ShortDatePattern = "dd-MMM-yyyy";
LabelDate.Text = DtmDate.ToString("d", dfi);Note the difference : In ShortDatePattern, you can give any format. "mm" gives month in number and "MMM" gives month as short form of month (ie. three characters) :)
Rate this message. Thank you. Harini :)
-
Hi Here is an example for displaying date in any format:
DateTime DtmDate = DateTime.Now;
System.Globalization.DateTimeFormatInfo dfi = new System.Globalization.DateTimeFormatInfo();
dfi.ShortDatePattern = "dd-MMM-yyyy";
LabelDate.Text = DtmDate.ToString("d", dfi);Note the difference : In ShortDatePattern, you can give any format. "mm" gives month in number and "MMM" gives month as short form of month (ie. three characters) :)
Rate this message. Thank you. Harini :)
-
I wanted to display todays date in dd-mmm-yy fromat. can anybody help me please.(Asp/c#) Ak
You can also get today's date by Now.ToString("dd-MMM-yy")
Regards, Venkatesh Mookkan. Software Engineer, India My: Website | Yahoo Group