Click here to Skip to main content
15,897,371 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

In my Project i have two Time . Start Time :2013-10-04 09:00:00 End Time: 2013-10-04 18:00:00

I want to Know how many 15 Mins are there between these time. does any body have an code to do these help me

Thanks
parithi
Posted

hi,
Check this.
C#
DateTime dt1 = Convert.ToDateTime("2013-10-04 09:00:00");
DateTime dt2 = Convert.ToDateTime("2013-10-04 18:00:00");
TimeSpan dt;
if (dt1 > dt2)
{
    dt = dt1 - dt2;
}
else
{
    dt = dt2 - dt1;
}

double minutes = dt.TotalMinutes;
double total15min = minutes / 15;

Hope it helps you.
Thanks
 
Share this answer
 
v2
Comments
parithi vr 4-Oct-13 2:19am    
Thanks For the help. i modified it little
Harshil_Raval 4-Oct-13 2:25am    
If you find something better, then update my answer so that other can get best answer. :)
This article has (almost)everything.
Time Period Library for .NET[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900