Herry Markowitz
Herry Markowitz

Reputation: 308

Add 72 seconds to Now.ToString and show result?

When I run following code MsgBox shows 2015.12.15-03.31.21

MsgBox(Now.ToString("yyyy.MM.dd-HH.mm.ss"))

I want to add 72 seconds to 2015.12.15-03.31.21 and hope to see 2015.12.15-03.32.33.

I tried following code but it doesnt work.

MsgBox(Now.ToString("yyyy.MM.dd-HH.mm.ss") + 72)

Any support?

Upvotes: 1

Views: 50

Answers (1)

Trent Sartain
Trent Sartain

Reputation: 446

You will want to use the 'AddSeconds' method as follows:

DateTime.Now.AddSeconds(72)

In your example, it would be:

MsgBox(Now.AddSeconds(72).ToString("yyyy.MM.dd-HH.mm.ss"))

Upvotes: 2

Related Questions