471,354 Members | 1,181 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Date Formats

anyone know how to get this working?

string ergggg = "20051201 162533";
DateTimeFormatInfo myDTFI = new CultureInfo( "en-Gb",
false ).DateTimeFormat;
myDTFI.FullDateTimePattern = "yyyyMMdd hhmmss";
DateTime switchdate = DateTime.ParseExact(datething,"yyyyMMdd hhmmss",
myDTFI);
string ace = switchdate.ToString();

--

Regards

Ian Frawley
Dec 1 '05 #1
2 4116
Ian,

You want to use this instead:

myDTFI.FullDateTimePattern = "yyyyMMdd HHmmss";
DateTime switchdate = DateTime.ParseExact(datething,"yyyyMMdd HHmmss",
myDTFI);

Note the capital H. This will interpret the hour as military time,
instead of am/pm.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Ian Frawley" <ye**@yeah.com> wrote in message
news:OW**************@TK2MSFTNGP12.phx.gbl...
anyone know how to get this working?

string ergggg = "20051201 162533";
DateTimeFormatInfo myDTFI = new CultureInfo( "en-Gb",
false ).DateTimeFormat;
myDTFI.FullDateTimePattern = "yyyyMMdd hhmmss";
DateTime switchdate = DateTime.ParseExact(datething,"yyyyMMdd hhmmss",
myDTFI);
string ace = switchdate.ToString();

--

Regards

Ian Frawley

Dec 1 '05 #2

"Nicholas Paldino [.NET/C# MVP]" wrote in message

Hi Nicholas,

Bingo thats fixed me problem many many thanks.

Ian
Ian,

You want to use this instead:

myDTFI.FullDateTimePattern = "yyyyMMdd HHmmss";
DateTime switchdate = DateTime.ParseExact(datething,"yyyyMMdd HHmmss",
myDTFI);

Note the capital H. This will interpret the hour as military time,
instead of am/pm.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Ian Frawley" <ye**@yeah.com> wrote in message
news:OW**************@TK2MSFTNGP12.phx.gbl...
anyone know how to get this working?

string ergggg = "20051201 162533";
DateTimeFormatInfo myDTFI = new CultureInfo( "en-Gb",
false ).DateTimeFormat;
myDTFI.FullDateTimePattern = "yyyyMMdd hhmmss";
DateTime switchdate = DateTime.ParseExact(datething,"yyyyMMdd hhmmss",
myDTFI);
string ace = switchdate.ToString();

--

Regards

Ian Frawley


Dec 1 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Gerrit Holl | last post: by
3 posts views Thread by praba kar | last post: by
15 posts views Thread by Simon Brooke | last post: by
4 posts views Thread by Richard Hollenbeck | last post: by
36 posts views Thread by Martin Herrman | last post: by
6 posts views Thread by Jim Davis | last post: by
3 posts views Thread by Leo Muller | last post: by
9 posts views Thread by Bob Achgill | last post: by
9 posts views Thread by SOLVER | last post: by
reply views Thread by XIAOLAOHU | 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.