TimeSpan変数について

こんにちは
UiPath Studio 2025.0.161 Community editionのユーザーです。

TimeSpan変数についてについて教えてください。

45時間-12時間55分の時間計算をする目的で

ts_TimeSpan1=TimeSpan.Parse("45:00:00")

を実行後にローカルパネルを見たら、

ts_TimeSpan1に45日が格納されていました。(下図参照)

TimeSpan変数は24時間を超える時間を扱えないのでしょうか?

Hi @gorby ,
you should use below methods:

  1. New TimeSpan(45,0,0)
  2. TimeSpan.Fromhours(45)

TimeSpan.ParseExtract(“15:00:00”,“hh:mm:ss”,Nothing) → This one works up to 23 hours

Regards,
Arivu

@gorby

It can store and handle greater than 24 hours but the method is little different.

To store more than 24 hours you will have to parse it like this.

ts_TimeSpan1 = TimeSpan.Parse("1.21:00:00")

in here 1 is a day that’s 24 hours and 21 would be the remaining hours

Using ts_TimeSpan1 .TotalHours will give you 45 as output.

If you are going to get only the hours and want to parse it automatically, refer this logic.

ts_TimeSpan1  = New TimeSpan(intTotalHours \24, intTotalHours Mod 24, intMinutes, intSeconds)

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