White space issue when parsing datetime

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

    #1

    White space issue when parsing datetime

    Hi All,

    i have two accepted formats.

    expectedFormats = New String() {"%M/%d/yyyy", "%M/%d/yyyy hh:mm:ss
    tt"}

    dt = DateTime.ParseE xact(txtInpDate String.Text, expectedFormats ,
    culture.DateTim eFormat, Globalization.D ateTimeStyles.A llowWhiteSpaces )


    and i get 05/14/200711:22:33 AM as a valid date. (Note: there is no
    space between year and time) and i am pretty sure zero lenght string
    is not a white space.


    Please help

  • PlatinumBay

    #2
    Re: White space issue when parsing datetime

    parez,

    DateTime.ParseE x is used to read a string into a DateTime object. The
    example you show is a String so I assume you are doing a dt.ToString with
    some output format?


    Steve


    "parez" <psawant@gmail. comwrote in message
    news:1181333714 .613735.72230@g 4g2000hsf.googl egroups.com...
    Hi All,
    >
    i have two accepted formats.
    >
    expectedFormats = New String() {"%M/%d/yyyy", "%M/%d/yyyy hh:mm:ss
    tt"}
    >
    dt = DateTime.ParseE xact(txtInpDate String.Text, expectedFormats ,
    culture.DateTim eFormat, Globalization.D ateTimeStyles.A llowWhiteSpaces )
    >
    >
    and i get 05/14/200711:22:33 AM as a valid date. (Note: there is no
    space between year and time) and i am pretty sure zero lenght string
    is not a white space.
    >
    >
    Please help
    >

    Comment

    Working...