Results 1 to 9 of 9

Thread: [RESOLVED] [2005] DateTime

  1. #1

    Thread Starter
    Fanatic Member vijy's Avatar
    Join Date
    May 2007
    Location
    India
    Posts
    548

    Resolved [RESOLVED] [2005] DateTime

    I am getting a datetime like this....
    What format is this???


    Code:
    D:20080929130007+05'30'
    When am trying to parse like below,error am getting
    Code:
        Dim dTemp As DateTime= DateTime.Parse(hTemp("CreationDate").ToString())
    The string was not recognized as a valid DateTime. There is a unknown word starting at index 0.
    Visual Studio.net 2010
    If this post is useful, rate it


  2. #2
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    Re: [2005] DateTime

    where did it come from?
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  3. #3

    Thread Starter
    Fanatic Member vijy's Avatar
    Join Date
    May 2007
    Location
    India
    Posts
    548

    Re: [2005] DateTime

    From itextsharp..its a third party .net component for manipulating pdf.

    am trying to get the cretion time of the pdf..
    Visual Studio.net 2010
    If this post is useful, rate it


  4. #4
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    Re: [2005] DateTime

    this D:20080929130007+05, looks like

    2008 09 29 13:00:07 +05

    sep 29 2008
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  5. #5

    Thread Starter
    Fanatic Member vijy's Avatar
    Join Date
    May 2007
    Location
    India
    Posts
    548

    Re: [2005] DateTime

    Quote Originally Posted by dbasnett
    this D:20080929130007+05, looks like

    2008 09 29 13:00:07 +05

    sep 29 2008

    yes yes.. how you converted this..
    i need the code..
    Visual Studio.net 2010
    If this post is useful, rate it


  6. #6

    Thread Starter
    Fanatic Member vijy's Avatar
    Join Date
    May 2007
    Location
    India
    Posts
    548

    Re: [2005] DateTime

    Quote Originally Posted by dbasnett
    this D:20080929130007+05, looks like
    wthether this an standard time format???
    Visual Studio.net 2010
    If this post is useful, rate it


  7. #7
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    Re: [2005] DateTime

    not any standard i know of
    Code:
            Dim tst As String = "D:20080929130007+05"
            Dim newDT As DateTime
            newDT = DateTime.Parse(tst.Substring(6, 2).PadRight(3, " "c) & _
                                   tst.Substring(8, 2).PadRight(3, " "c) & _
                                   tst.Substring(2, 4).PadRight(5, " "c) & _
                                   tst.Substring(10, 2).PadRight(3, ":"c) & _
                                   tst.Substring(12, 2).PadRight(3, ":"c) & _
                                   tst.Substring(14, 2))
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  8. #8

    Thread Starter
    Fanatic Member vijy's Avatar
    Join Date
    May 2007
    Location
    India
    Posts
    548

    Re: [2005] DateTime

    Well.. i too thought of this string manipulation only.,.
    thanks a lot for finding the D:20080929130007+05 format...
    Visual Studio.net 2010
    If this post is useful, rate it


  9. #9
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [RESOLVED] [2005] DateTime

    The +05 is the offset from GMT, but I don't know what the '30' is for.
    vb.net Code:
    1. Dim s As String = "D:20080929130007+05"
    2. Dim d As Date = Date.ParseExact(s, "D:yyyyMMddHHmmsszz", Nothing)
    3.  
    4. MessageBox.Show(d.ToString(), "Local")
    5. MessageBox.Show(d.ToUniversalTime.ToString(), "UTC")
    Unless you're in the GMT+5 time zone then neither of the displayed values will be 1:00:07 PM on September 29, 2008. The second displayed value will be 5 hours before, i.e. 8:00:07 AM, which accounts for the +05 time zone offset. the first displayed value will depend on where you are. I'm in Sydney, Australia and we have daylight saving at the moment. That means our time zone is GMT+10 so I see 6:00:07 PM.
    Last edited by jmcilhinney; Nov 23rd, 2008 at 09:41 PM.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width