Date Formats

I

Ian Frawley

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();
 
N

Nicholas Paldino [.NET/C# MVP]

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.
 
I

Ian Frawley

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]
- (e-mail address removed)

Ian Frawley said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top