DateTime変数を基準値と比較できません

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

下記画像のExcelをRead RangeしてDataTable dtに取得し、B列が7時以上12時未満だったら、F列に"午前"と出力するWFを作成しました。
TimeSpan

B列の値をTimeSpan変数に取得したら期待通り動いてくれましたが、B列の値をDateTime変数に取得したら、F列に何も出力されませんでした。
別のWFでDateTime変数同志を大小比較できた経験があるため、不思議です。
下記に両方のコードを記述しますので、DateTime変数を基準値と比較したコードにバグがないかどうか見ていただけないでしょうか。

よろしくお願いします。

TimeSpan変数を基準値と比較したコード
CDate(Row(“Start”).ToString).TimeOfDay >= TimeSpan.FromHours(7) AndAlso CDate(Row(“Start”).ToString).TimeOfDay < TimeSpan.FromHours(12)

DateTime変数を基準値と比較したコード
CDate(Row(“Start”).ToString) >= DateTime.ParseExact(“07:00:00”, “HH:mm:ss”, CultureInfo.InvariantCulture) AndAlso CDate(Row(“Start”).ToString) < DateTime.ParseExact(“12:00:00”, “HH:mm:ss”, CultureInfo.InvariantCulture)

@gorby

If you convert to datetime…instead of time only…there is a date component that gets added as well which will not be same as compring only time…if you print the converted values you would see that there is a different between convertion to date which will append a dummy date to the timestamp

Cheers

Sorry.I could
not understand what you said.

@gorby

I hope this will make you understand the difference

image

as you use cdate and datetime.parse the dates will be appended and the dates appended will be different and will make it fail …that is why to compare time we take only the time part

cheers