How can I convert a string like '200412240000' to a DateTime type.
D Dan Bass Dec 23, 2004 #2 Use the ToString() method... DateTime myTime = DateTime.Now; string myTimeSting = myTime.ToString ( "yyyyMMddHHmm");
Use the ToString() method... DateTime myTime = DateTime.Now; string myTimeSting = myTime.ToString ( "yyyyMMddHHmm");
H Hans Kesting Dec 23, 2004 #3 Ha said: How can I convert a string like '200412240000' to a DateTime type. Click to expand... DateTimeFormatInfo myDTFI = new DateTimeFormatInfo(); myDTFI.ShortDatePattern = "yyyyMMddHHmm"; DateTime dt = DateTime.Parse(pDateString, myDTFI); Hans Kesting
Ha said: How can I convert a string like '200412240000' to a DateTime type. Click to expand... DateTimeFormatInfo myDTFI = new DateTimeFormatInfo(); myDTFI.ShortDatePattern = "yyyyMMddHHmm"; DateTime dt = DateTime.Parse(pDateString, myDTFI); Hans Kesting
J Jon Skeet [C# MVP] Dec 23, 2004 #4 Ha ha said: How can I convert a string like '200412240000' to a DateTime type. Click to expand... I would suggest using the DateTime.ParseExact method.
Ha ha said: How can I convert a string like '200412240000' to a DateTime type. Click to expand... I would suggest using the DateTime.ParseExact method.
T Tom Porterfield Dec 23, 2004 #5 How can I convert a string like '200412240000' to a DateTime type. Click to expand... DateTime date = DateTime.ParseExact("200412240000" , "yyyyMMddHHmm" , new DateTimeFormatInfo());
How can I convert a string like '200412240000' to a DateTime type. Click to expand... DateTime date = DateTime.ParseExact("200412240000" , "yyyyMMddHHmm" , new DateTimeFormatInfo());
I Ignacio Machin \( .NET/ C# MVP \) Dec 23, 2004 #6 Hi, DateTime.ParseExact What the trailing 4 ceros means? Cheers,
I Ignacio Machin \( .NET/ C# MVP \) Dec 23, 2004 #7 Hi, I think he wants the opposite , from string to datetime Cheers,
D Dan Bass Dec 23, 2004 #8 READ the question Dan, READ the question... ;o) Ignacio Machin ( .NET/ C# MVP ) said: Hi, I think he wants the opposite , from string to datetime Cheers, Click to expand...
READ the question Dan, READ the question... ;o) Ignacio Machin ( .NET/ C# MVP ) said: Hi, I think he wants the opposite , from string to datetime Cheers, Click to expand...