datetime string conversion

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

    datetime string conversion

    We recently converted a legacy database to SQL Server.
    A field in legacy contained a start and end date range
    example mmddyy-mmddyy. This information was converted
    into a SQL character string. I must use the SQL column to
    do date comparisions, addition and store in a true date
    format in another table. I did a split into two separate
    strings then tried using convert.todatet ime, parse etc.
    but I just can't get it to work. Can someone give me an
    example?

    thanks


  • Shawn

    #2
    Re: datetime string conversion

    try this
    string format = "MMddyy";
    DateTime date = DateTime.ParseE xact(str,format ,null);

    "rick" <rick@yc.edu> news:018501c37a fe$585df3e0$a40 1280a@phx.gbl.. .[color=blue]
    > We recently converted a legacy database to SQL Server.
    > A field in legacy contained a start and end date range
    > example mmddyy-mmddyy. This information was converted
    > into a SQL character string. I must use the SQL column to
    > do date comparisions, addition and store in a true date
    > format in another table. I did a split into two separate
    > strings then tried using convert.todatet ime, parse etc.
    > but I just can't get it to work. Can someone give me an
    > example?
    >
    > thanks
    >
    >[/color]


    Comment

    • rick

      #3
      Re: datetime string conversion

      Shawn; Thanks! That is exactly what I needed.

      rick


      [color=blue]
      >-----Original Message-----
      >try this
      > string format = "MMddyy";
      > DateTime date = DateTime.ParseE xact(str,format ,null);
      >
      >"rick" <rick@yc.edu> news:018501c37a fe$585df3e0[/color]
      $a401280a@phx.g bl...[color=blue][color=green]
      >> We recently converted a legacy database to SQL Server.
      >> A field in legacy contained a start and end date range
      >> example mmddyy-mmddyy. This information was converted
      >> into a SQL character string. I must use the SQL column[/color][/color]
      to[color=blue][color=green]
      >> do date comparisions, addition and store in a true date
      >> format in another table. I did a split into two[/color][/color]
      separate[color=blue][color=green]
      >> strings then tried using convert.todatet ime, parse etc.
      >> but I just can't get it to work. Can someone give me[/color][/color]
      an[color=blue][color=green]
      >> example?
      >>
      >> thanks
      >>
      >>[/color]
      >
      >
      >.
      >[/color]

      Comment

      Working...