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

I want to calculate time between Start Time and End Time for Remaining Time

12 hours with am, pm

For exam demo.

any buddy face this type of problems Plz help me.




eg.

Exam Time : 02:30 hours , suppose Current time is : 12:00 pm


Start Time : 11:20 am

End Time : 01:50 pm

Remaining Time : 01 hours 50 minutes



Thanks in Advance.
Posted

VB
Dim startdate As DateTime = new dateTime(2011, 7, 1, 5, 36, 0, 0)
Dim enddate As DateTime = dateTime.Now;
Dim difference As TimeSpan = enddate - startdate;
 
Share this answer
 
Comments
Simon Bang Terkildsen 25-Aug-11 13:13pm    
Beat me to it
Sergey Alexandrovich Kryukov 25-Aug-11 23:05pm    
Sure, a 5.
--SA
VB
Dim startTime As DateTime
Dim endTime As DateTime

Dim totalTime As TimeSpan = endTime - start

Dim timeRemaining As TimeSpan = totalTime - (DateTime.Now - start)
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 25-Aug-11 23:05pm    
Sure, a 5.
--SA

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