DateTime in unix format

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to convert a datetime to unixstyle datetime, in other words the number
of seconds since 1-1-1970.

Do I have to calculate this myself using the ticks, or does the BCL provide
an easier way for this?
 
Philip Wagenaar said:
I need to convert a datetime to unixstyle datetime, in other words the
number
of seconds since 1-1-1970.

Do I have to calculate this myself using the ticks, or does the BCL
provide
an easier way for this?

How about using the DateDiff function?

HTH,
Mythran
 
Philip Wagenaar said:
I need to convert a datetime to unixstyle datetime, in other words
the number of seconds since 1-1-1970.

Do I have to calculate this myself using the ticks, or does the BCL
provide an easier way for this?


dim diff as double

diff = yourdate.subtract(#1/1/1970#).totalseconds



Armin
 
Philip,

Do you mean something as this

MessageBox.Show(CType(Now.Subtract(New System.DateTime(1970, 1, 1)),
TimeSpan).TotalSeconds.ToString)

I hope this helps,

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top