Powershell How to add a number into a variable

Question:

how can I add a number to another number contained into a variable?

so, if $t0 is 1030, I would $t1 values 1040.

Answer:

force to [int] before assign value to $t0 ( get-date -uformat returns [string] type ):

if you change the order the coercing feature of powershell gives the expected value:

because second operand is cast to type of first one

Source:

Powershell How to add a number into a variable by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply