Timestamp

bm82

New member
Joined
Jan 12, 2004
Messages
1
Anyone know how to get unix timestamp in .net. Is there any library out there to calculate it?

Thank you ;)
 
I believe the UNIX epoch is 1/1/70, and UNIX timestamps are the amount of seconds since then. So just calculate the seconds from that date till now and you have your timestamp :D. If you want I could try creating a module for this... :)
 
If thats the case...

Code:
Dim seconds As Long

seconds = Convert.ToInt64(Now.Subtract(DateTime.Parse("1/1/70")).Ticks / TimeSpan.TicksPerSecond)
 
Code:
        Dim unixdate as New Date
        unixdate = New Date
        unixdate = unixdate.AddYears(1969)
        unixdate = unixdate.Add(System.TimeSpan.FromSeconds(TextBox1.Text))
        MsgBox(unixdate.ToLocalTime.ToString())

:)

Just replace TextBox1.Text with the variable of the timestamp.

(Timestamp -> Date)
 
Last edited by a moderator:
Back
Top