ASP.NET - CAlculate time

Asked By myzonal.com myzonal.com on 18-Jun-10 05:09 AM

Hi All



How we calculate time like orkut scraps.

In days and date ..


plz help me soon????

Thx in advance??????

Santhosh N replied to myzonal.com myzonal.com on 18-Jun-10 05:17 AM

You can get the time difference between two dates in almost any technology be it c#, sql server, vb.net, oracle and you can display that in comparision to the current date time with stored date and time..

DateTime startTime = Convert.ToDateTime("06/05/2026");

DateTime endTime = DateTime.Now;
TimeSpan t= endTime.Subtract ( startTime );

Here t contains all the info like t.Days gives number of days, t.Hours gives number of hours, etc..

Parag Satpute replied to myzonal.com myzonal.com on 18-Jun-10 05:19 AM

result time(in hours:min:sec) = Current time - Time when scrap posted


If >24 hours then,

result time(in days) = result time(in hours:min:sec) / 24