UiPathでは24時間を超える時間同士の時間計算はできないのでしょうか?

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

代入アクティビティで
ts_TimeSpan1=TimeSpan.Parse("25:30:00")
を実行したら、下記のエラーが出ました。TimeSpan変数では24時間を超える時間を格納できないようです。
UiPathでは例えば、25時間 + 25時間30分 = 50時間30分 などという時間計算はできないのでしょうか?


System.InvalidOperationException: 'TimeSpan.Parse("25:30:00")' を 'ts_TimeSpan1' に割り当てられません。 ---> System.OverflowException: The TimeSpan string '25:30:00' could not be parsed because at least one of the numeric components is out of range or contains too many digits.   at System.Globalization.TimeSpanParse.TimeSpanResult.SetOverflowFailure()
   at System.Globalization.TimeSpanParse.ProcessTerminal_HM_S_D(TimeSpanRawInfo& raw, TimeSpanStandardStyles style, TimeSpanResult& result)
   at System.Globalization.TimeSpanParse.ProcessTerminalState(TimeSpanRawInfo& raw, TimeSpanStandardStyles style, TimeSpanResult& result)
   at System.Globalization.TimeSpanParse.TryParseTimeSpan(ReadOnlySpan`1 input, TimeSpanStandardStyles style, IFormatProvider formatProvider, TimeSpanResult& result)
   at System.TimeSpan.Parse(String s)

@gorby

Timespan should be within 24 hours.

Try like this..

“23:30:00”

In UiPath, is it possible to perform time calculations such as 25 hours + 25 hours and 30 minutes = 50 hours and 30 minutes?

@gorby,

Try this LLM suggested way.

// Create individual TimeSpan objects
TimeSpan time1 = TimeSpan.FromHours(25);
TimeSpan time2 = TimeSpan.FromHours(25).Add(TimeSpan.FromMinutes(30));

// Add the TimeSpan objects together
TimeSpan totalTime = time1.Add(time2);

// Output the total time as string
string result = totalTime.ToString(@"%h\:mm");

こんにちは

いくつか回避策がありますが、例えば文字列中のそれぞれの値をTimeSpanコンストラクターに押し込めば通ります。

strTs="25:30:00"

New TimeSpan(CInt(strTs.Split(":"c)(0)),CInt(strTs.Split(":"c)(1)),CInt(strTs.Split(":"c)(2)))

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