dcsimg
Results 1 to 2 of 2

Thread: Add seconds in current time

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jul 2017
    Posts
    26

    Add seconds in current time

    Hello everyone,

    I have a label_time.text that displays the time of my computer in the form 00:00:00
    How could I add 2 seconds to my label_time ?

    Thank you for your ideas

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    40,027

    Re: Add seconds in current time

    When you get the time, put .AddSeconds(2) on the end of it.

    Assuming you are currently using DateTime.Now like this:
    Code:
    label_time.text = DateTime.Now.ToString("HH:mm:ss")
    ...it would become this:
    Code:
    label_time.text = DateTime.Now.AddSeconds(2).ToString("HH:mm:ss")

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width