How to convert a DateTime to a long

  • Thread starter Thread starter Vicki Carlsen
  • Start date Start date
V

Vicki Carlsen

Hi,

What is the easiest way to convert a DateTime object to a
long?? - And the other way back??
(For database use)

Regards,

Vicki
 
DateTime dateTime = ....
long number = Convert.ToInt64( dateTime );
or
long number = dateTime.Ticks;
 
long number = Convert.ToInt64(dataTime), does not work.
But long numer = dateTime.Ticks, was all I needed to
know... Thanks :o)

Regards,

Vicki
 
Back
Top