Parsing strings containing date and time

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Morten Wennevik

    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/
  • Dmitriy Lapshin [C# / .NET MVP]

    #2
    Re: Parsing strings containing date and time

    Hi,

    DateTimeStyles and DateTimeFormatI nfo 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

    Bring the power of unit testing to VS .NET IDE

    "Morten Wennevik" <MortenWennevik @hotmail.com> wrote in message
    news:opry5dgsx5 hntkfz@localhos t...[color=blue]
    > 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/[/color]

    Comment

    Working...