Increase or Decrease The Time

Hello,

I have a question about how to get the total timestamp. The scenario is increase or decrease 10 minutes from current hours. Example:

Current Hours is 11:00
Total: 11:10 (Increase) | 10:50 (Decrease)

Thank in advanced. Regards,
Brian

@henokhbrian

Try below expression.

For Increase:

            Now.AddMinutes(10).ToString("hh:mm")

For Decrease:

             Now.AddMinutes(-10).ToString("hh:mm")

If you want it in 24 Hrs format then replace “hh” with “HH”.

1 Like

I forgot this,
how to assign the current hours to be 11:00 and what the type of that variable?

@henokhbrian

Create string variable and assign the above expressions to it.

I have a scenario,

Steps:
1. Variable(DateTime) → timer1 = System.DateTime.Now. This variable will be increase 10 minutes.
2. Variable(DateTime) → timer2 = System.DateTime.Now.
3. The output from calculation process in step 1 will be decrease with timer2.

Can you help me for this scenario?

@henokhbrian

Try below expression.

            Timespan ts = timer1 - timer2

Where timer1 and timer2 are of type DateTime variables.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.