J Jack Jun 11, 2004 #1 I am trying to format a DateTime object as mmddyyyy and NOT mm/dd/yyyy. What is the easiest way to do this?
I am trying to format a DateTime object as mmddyyyy and NOT mm/dd/yyyy. What is the easiest way to do this?
G Guest Jun 11, 2004 #3 Use the ToString overload and pass the format required in it. Eg: dt.ToString("mmddyyyy"); or dt.ToString("dd-mm-yy");
Use the ToString overload and pass the format required in it. Eg: dt.ToString("mmddyyyy"); or dt.ToString("dd-mm-yy");
J Jack Jun 11, 2004 #4 That is what I was attempting but found a nuance... mmddyyyy formats as minute, day, month. The correct format is MMddyyyy.
That is what I was attempting but found a nuance... mmddyyyy formats as minute, day, month. The correct format is MMddyyyy.
A anon Feb 15, 2005 #5 Jack said: I am trying to format a DateTime object as mmddyyyy and NOT mm/dd/yyyy. What is the easiest way to do this? Click to expand... DateTime dt = DateTime.Now; System.Console.WriteLine(string.Format("{0,2:00}{1,2:00}{2,04:0000}",dt.Day,dt.Month,dt.Year));
Jack said: I am trying to format a DateTime object as mmddyyyy and NOT mm/dd/yyyy. What is the easiest way to do this? Click to expand... DateTime dt = DateTime.Now; System.Console.WriteLine(string.Format("{0,2:00}{1,2:00}{2,04:0000}",dt.Day,dt.Month,dt.Year));
J Jonathan Stowe Feb 15, 2005 #6 anon said: DateTime dt = DateTime.Now; System.Console.WriteLine(string.Format("{0,2:00}{1,2:00}{2,04:0000}",dt.Day,dt.Month,dt.Year)); Click to expand... or alternatvely: dt.ToString("MMddyyyy"); /J\
anon said: DateTime dt = DateTime.Now; System.Console.WriteLine(string.Format("{0,2:00}{1,2:00}{2,04:0000}",dt.Day,dt.Month,dt.Year)); Click to expand... or alternatvely: dt.ToString("MMddyyyy"); /J\