Converting unix time to DateTime
This line of code
nDateTime.AddSeconds(nTimestamp)
does not modify nDateTime
. It's like writing a + 3
on a line by it's own -- a
won't be modified.
It does, however, return a new DateTime object that contains the incremented value. So, what you actually wanted to write is:
nDateTime = nDateTime.AddSeconds(nTimestamp)
PS: It appears that your code does not use Option Strict On
. It is strongly recommended that you activate Option Strict
and use explicit instead of implicit conversions.