time formatting error

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • linuxnooby@yahoo.com.au

    #1

    time formatting error

    Hi

    I am trying to display a unix timestamp as a time of day. I can do this
    but I lose 10 hours. Is this something do with locale or is there an
    error in my code?? The timestamp is for 11.20 am, but the message box
    displays 1.20am !!

    Dim timestamp As Integer = 1159492831

    Dim dt As Date = New System.DateTime (1970, 1, 1).AddSeconds(t imestamp)

    MessageBox.Show (Format(dt, "hh:mm tt"))


    any help appreciated
    Dave

  • xfile

    #2
    Re: time formatting error

    Hi,

    I am not an expert but I know sometime it could happen if your server is
    hosted remotely.

    Is it your case? If so, you may need adding extra 10 hours to values.
    Don't ask me how, I am an idiot in programming :)

    Hope this helps.

    <linuxnooby@yah oo.com.auwrote in message
    news:1159493903 .933034.216640@ h48g2000cwc.goo glegroups.com.. .
    Hi
    >
    I am trying to display a unix timestamp as a time of day. I can do this
    but I lose 10 hours. Is this something do with locale or is there an
    error in my code?? The timestamp is for 11.20 am, but the message box
    displays 1.20am !!
    >
    Dim timestamp As Integer = 1159492831
    >
    Dim dt As Date = New System.DateTime (1970, 1, 1).AddSeconds(t imestamp)
    >
    MessageBox.Show (Format(dt, "hh:mm tt"))
    >
    >
    any help appreciated
    Dave
    >

    Comment

    • linuxnooby@yahoo.com.au

      #3
      Re: time formatting error

      There is no remote server involved, the timestamp is generated on the
      local machine.

      cheers Dave


      xfile wrote:
      Hi,
      >
      I am not an expert but I know sometime it could happen if your server is
      hosted remotely.
      >
      Is it your case? If so, you may need adding extra 10 hours to values.
      Don't ask me how, I am an idiot in programming :)
      >
      Hope this helps.
      >
      <linuxnooby@yah oo.com.auwrote in message
      news:1159493903 .933034.216640@ h48g2000cwc.goo glegroups.com.. .
      Hi

      I am trying to display a unix timestamp as a time of day. I can do this
      but I lose 10 hours. Is this something do with locale or is there an
      error in my code?? The timestamp is for 11.20 am, but the message box
      displays 1.20am !!

      Dim timestamp As Integer = 1159492831

      Dim dt As Date = New System.DateTime (1970, 1, 1).AddSeconds(t imestamp)

      MessageBox.Show (Format(dt, "hh:mm tt"))


      any help appreciated
      Dave

      Comment

      Working...