Int型をtimespan型へ変更したい

いつもお世話になっております。
Int型をtimespan型へ変更したいと考えております。
例:2→00:00:02
上記実施するために、変換がうまくいかないためじっしほうほうをおしえていただきたいです。

よろしくお願いします

こんにちは

以下いかがでしょうか?

TimeSpan.FromSeconds(2)

image

Hi @natsumikan

Could you please try the following expressions once?

intSeconds = 2
timeSpanResult = New TimeSpan(0, 0, intSeconds)
formattedTime = timeSpanResult.ToString("hh\:mm\:ss")

Hope this helps,
Best Regards.

you can try this way

strSeconds= 2

condition =TimeSpan.FromSeconds(strSeconds)

image

@natsumikan

Hi @natsumikan

timeSpanVar (Data Type: System.TimeSpan)
Assign
  timeSpanVar= New TimeSpan(0, 0, 2)

Log Message
  Message: "TimeSpan Value: " + timeSpanVar.ToString()

Hope it helps!!

Hi,

create output variable(TimeSpanValue) variable type is TimeSpan
and save your value as intValue

  • CInt(intValue) converts the intValue variable to an Integer.
  • TimeSpan.FromSeconds() creates a TimeSpan from the converted Integer.