简体   繁体   中英

how can i add time within time and show to label2 the added time? c#

TimeAdded?

is there a way add time? in the image

if i click the AddedTimeButton the label1 or the running time will add another hour and show it to label2

In the image label1 is 2:15:06 and if i click the button lets say the button can add 1 hour in the time and after i click it it will show in the label2 the added time 3:15:06.

is there a logic code for it or is it possible?

Here's a high-level idea. Please change it to suit your implementation.

Label label1 = new Label();
Label label2 = new Label();

DateTime time = DateTime.Today;
label1.Text = time.ToString();

void OnButtonClicked()
{
     label2.Text = time.AddHours(1);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM