Click here to Skip to main content
15,881,852 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How do i calculate time between running live time from timer1 and a datetimepicker1.value?


What I have tried:

I do not know how to do this.I want your ideas.Thank you in advance!
Posted
Updated 5-May-20 3:04am

Use the DateTime Struct (System) | Microsoft Docs[^]. It is a good idea to study the documentation so you learn some of the more common and useful classes.
 
Share this answer
 
When you subtract two DateTime values, you get a TimeSpan value representing the duration between them:
C#
DateTime startDate = datetimepicker1.Value;
Datetime now = DateTime.Now; // The datetime at the tick of the timer
TimeSpan duration = now - startDate; // The duration between both datetimes
 
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