By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,676 Members | 1,708 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,676 IT Pros & Developers. It's quick & easy.

how to find Seconds elapsed ? ....

P: n/a
Hi,

Can any one help me getting Seconds elapsed from a given date time to
current time in .Net?.

for e.g.

Suppose assume a given time date time "01-Jan-2000 00:00:00",
I should get the number of seconds elapsed from the given date time to
current date time.

Thanks & Regards
Prakash K. Prabhu

Nov 15 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi,

DateTime then = new DateTime ( ... ); // the old date
double seconds = (DateTime.Now - then).TotalSeconds;

//the substraction of two datetime is a TimeSpan , if you want that the
autocomplete works on VS you shoudl do this:
double seconds = ( (TimeSpan) (DateTime.Now - then)).TotalSeconds;

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Prabhu" <Pr******@e-tapaal.com> wrote in message
news:eK**************@TK2MSFTNGP11.phx.gbl...
Hi,

Can any one help me getting Seconds elapsed from a given date time to
current time in .Net?.

for e.g.

Suppose assume a given time date time "01-Jan-2000 00:00:00",
I should get the number of seconds elapsed from the given date time to
current date time.

Thanks & Regards
Prakash K. Prabhu

Nov 15 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.