DateTime Formating

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

    DateTime Formating

    I hav a log.txt file which contains following DateTime format > Fri May 06
    18:05:54 GMT+05:30 2005 . so plzz help me how to accept this format & update
    in my DataBase, so that my webapplication DataGrid can display above DateTime
    format.
  • Tom Porterfield

    #2
    Re: DateTime Formating

    On Fri, 6 May 2005 07:40:05 -0700, sudip wrote:
    [color=blue]
    > I hav a log.txt file which contains following DateTime format > Fri May 06
    > 18:05:54 GMT+05:30 2005 . so plzz help me how to accept this format & update
    > in my DataBase, so that my webapplication DataGrid can display above DateTime
    > format.[/color]

    string str = "Fri May 06 18:05:54 GMT+05:30 2005";
    DateTime dt = DateTime.ParseE xact(str, "ddd MMM dd HH:mm:ss 'GMT'zzz yyyy",
    DateTimeFormatI nfo.CurrentInfo );

    Should do it.
    --
    Tom Porterfield

    Comment

    • sudip

      #3
      Re: DateTime Formating

      Hi Tom
      Thanks a ton for the mail, it has really helped me to read the DateTime from
      the log.text file , but how do update this format into my SQL database coz in
      my database table there is a Column named "DateTimeIn " which is unable accept
      this
      format > Fri May 06 18:05:54 GMT+05:30 2005.

      Thanx !!




      "Tom Porterfield" wrote:
      [color=blue]
      > On Fri, 6 May 2005 07:40:05 -0700, sudip wrote:
      >[color=green]
      > > I hav a log.txt file which contains following DateTime format > Fri May 06
      > > 18:05:54 GMT+05:30 2005 . so plzz help me how to accept this format & update
      > > in my DataBase, so that my webapplication DataGrid can display above DateTime
      > > format.[/color]
      >
      > string str = "Fri May 06 18:05:54 GMT+05:30 2005";
      > DateTime dt = DateTime.ParseE xact(str, "ddd MMM dd HH:mm:ss 'GMT'zzz yyyy",
      > DateTimeFormatI nfo.CurrentInfo );
      >
      > Should do it.
      > --
      > Tom Porterfield
      >[/color]

      Comment

      Working...