How to convert a DateTime to a long

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
 
C

Christian

DateTime dateTime = ....
long number = Convert.ToInt64( dateTime );
or
long number = dateTime.Ticks;
 
G

Guest

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

Regards,

Vicki
 

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

Top