471,627 Members | 1,572 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,627 software developers and data experts.

why is month format different ?

DateTime now = DateTime.Now; // { for Feb 9, 2006 }
string test = now.ToString("mm");
And I get 42 ?? what does this mean ?

For
string test = now.ToString("yyyydd");
test = "200609" ..
but
string test = now.ToString("yyyymmdd");
test = "20064209" .. I was expecting 20060209

--
Andrew
Feb 9 '06 #1
2 1225

"andrewcw" <an******@acw.com> wrote in message
news:57**********************************@microsof t.com...
DateTime now = DateTime.Now; // { for Feb 9, 2006 }
string test = now.ToString("mm");
And I get 42 ?? what does this mean ?

For
string test = now.ToString("yyyydd");
test = "200609" ..
but
string test = now.ToString("yyyymmdd");
test = "20064209" .. I was expecting 20060209

--
Andrew


You are getting the MINUTES portion of the date/time.

ToString expects mm for Minutes and MM for Month :)

Mythran

Feb 9 '06 #2
Thanks ! :)
--
Andrew
"Mythran" wrote:

"andrewcw" <an******@acw.com> wrote in message
news:57**********************************@microsof t.com...
DateTime now = DateTime.Now; // { for Feb 9, 2006 }
string test = now.ToString("mm");
And I get 42 ?? what does this mean ?

For
string test = now.ToString("yyyydd");
test = "200609" ..
but
string test = now.ToString("yyyymmdd");
test = "20064209" .. I was expecting 20060209

--
Andrew


You are getting the MINUTES portion of the date/time.

ToString expects mm for Minutes and MM for Month :)

Mythran

Feb 9 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by hunt4grouse | last post: by
34 posts views Thread by prosoft | last post: by
15 posts views Thread by Jozef Jarosciak | last post: by
22 posts views Thread by Stan | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.