Short Date Format

  • Thread starter Thread starter john bailo
  • Start date Start date
J

john bailo

If I use

DateTime.Now.ShortDateFormat().ToString it returns

10/8/2003

What I want is

10/08/2003

Is there an easy way to get DateTime.Now to return
the date with the leading zero.
 
john bailo said:
If I use

DateTime.Now.ShortDateFormat().ToString it returns

10/8/2003

What I want is

10/08/2003

Is there an easy way to get DateTime.Now to return
the date with the leading zero.

DateTime.Now.ToString("dd/MM/yyyy", DateTimeFormatInfo.InvariantInfo);
 
DateTime.Now.ToString("dd/MM/yyyy", DateTimeFormatInfo.InvariantInfo);

works perfect.

requires a reference to System.Globalization ( for using the
DateTimeFormatInfo class)
 
Back
Top