473,394 Members | 1,828 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Parsing strings containing date and time

I'm trying to get a DateTime object out of different strings containing
unknown datetimeformat.
An example would be "Mon, 24 Nov 2003 15:23:13 +0100"

DateTime.Parse() does not work and I'm not sure how to use the
IFormatProvider or DateTimeStyles
Any ideas?

(NB! currentculture is not English and time formats may also be non
english)

--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Nov 15 '05 #1
1 1539
Hi,

DateTimeStyles and DateTimeFormatInfo should be the way to go (the latter
implements IFormatProvider for dates/times by the way). Just play with the
settings to see what works - and MSDN Library docs should help you in that.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Morten Wennevik" <Mo************@hotmail.com> wrote in message
news:opry5dgsx5hntkfz@localhost...
I'm trying to get a DateTime object out of different strings containing
unknown datetimeformat.
An example would be "Mon, 24 Nov 2003 15:23:13 +0100"

DateTime.Parse() does not work and I'm not sure how to use the
IFormatProvider or DateTimeStyles
Any ideas?

(NB! currentculture is not English and time formats may also be non
english)

--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/


Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Gerrit Holl | last post by:
Posted with permission from the author. I have some comments on this PEP, see the (coming) followup to this message. PEP: 321 Title: Date/Time Parsing and Formatting Version: $Revision: 1.3 $...
9
by: Thomas W | last post by:
I'm developing a web-application where the user sometimes has to enter dates in plain text, allthough a format may be provided to give clues. On the server side this piece of text has to be parsed...
6
by: Tim N. van der Leeuw | last post by:
Hi, I want to parse strings containing date-time, which look like the following: "Mon Dec 19 11:06:12:333 CET 2005" That's a problem for strptime it seems, b/c I cannot find any...
12
by: Water Cooler v2 | last post by:
Are JavaScript strings mutable? How're they implemented - 1. char arrays 2. linked lists of char arrays 3. another data structure I see that the + operator is overloaded for the string class...
4
by: paul_zaoldyeck | last post by:
can anyone teach me how to append to datetime data into one. the first is a date and the 2nd one is a time. the time is converted from string. thanks
0
by: anonymous | last post by:
Hi! My current task included date parsing and recognizing. It's not enough hard but there are some problems. A lot of standards of date exists at this time: ISO,ARPA...+non standard date...
10
by: shakefu | last post by:
I'm new to python and I was wondering if there are any intelligent date/time parsing modules out there. I've looked at strptime (or whichever it is) and mxDateTime from the eGenix package. I need...
0
by: taa | last post by:
Hi there I’m trying to come up with a smart way of parsing content from textboxes in C#. I have about 7-10 boxes with different content; dates, times, numbers and text that has to be parsed and...
6
by: i_robot73 | last post by:
I have a file, containing hex values for dates (MMDDYYYY)<status code><??such as: ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.