tags:

views:

122

answers:

2

Is there any function in vb dot net to convert datetime to unix time stamp If I google I get only the vice versa but not vb.net to unix time stamp

Any help is appreciated

+1  A: 

Not to plagiarize, but this looks like it will do the trick fairly easily, if you are talking about:

seconds since Jan 1, 1970 = unix time

curtisk
+1  A: 

Looking at http://www.codeproject.com/KB/cs/timestamp.aspx it shows unix->.net so you can go backwards most likely:

DateTime dt = "the date";
DateTime start= new System.DateTime(1970, 1, 1, 0, 0, 0, 0);

TimeSpan ts = (dt - start);

ts.TotalSeconds //unix timestamp

or something similar will do it.

note, this has not been tested by me so it probably wont work :)

John Boker