How to add time and duration fields?

image

in these screen i have time and duration fields in excel.so i need to add that time and duration fields ex:3:00 PM,duration is 15:00 i need like this 03:15PM. is there any condition in uipath help me to resolve this.

Thanks in advance.

Hi @manogna

Use read range
and for each row in datatable

row(“Time”).ToString=“Split(”:".Environment.ToCharArray).Trim +row(“Duration”).ToString

Thanks
Ashwin S

when i wrote this condition i got this error.can i write this condition as type into activity.

Hi @manogna

StrRowTime=row(“Time”).Split(":".ToCharArray).Trim

StrDurationTime=row(“Duration”).ToString

print these values in message box like StrRowTime+StrDurationTime

Thanks
Ashwin S

Try below,

Hours=row(“Time”).ToString.Split(":“c)(0)
Minutes=Cint(row(“Time”).ToString.Split(”:“c)(1).Trim)
AMorPM=row(“Time”).ToString.Split(” "c)(1)

If (row(“Duration”).ToString.Contains(":"))
Then
Minutes=Minutes+Cint(row(“Duration”).ToString.Split(":“c)(0))
Else
Minutes=Minutes+Cint(row(“Duration”).ToString)
TotalTime=Hours+”:"+Minutes.Padleft(2,CChar(“0”))+" "+AMorPM

i have import data from excel to web application. so i need to add that two excel fields and i need to write in my web application field.

i have import data from excel to web application. so i need to add that two excel fields and i need to write in my web application field…

Use that variable TotalTime.

can i use this condition in type into activity.

Hi @manogna

Use hours as type into instead of condition

Thanks
Ashwin.S

row(“Time”).ToString.Split(":“c)(0)
here c means duration or something what’s that meaning.how to add duration for this condition can u write total condition and send me please.

Hi @manogna

C means char datatype

Thanks
Ashwin.S

i am facing this error.is there any mistakes in that condition

TotalTime=Hours+”:"+Minutes.Padleft(2,CChar(“0”))+" "+AMorPM

Minutes=Cint(row(“Time”).ToString.Split(”:“c)(1).Trim)
Minutes=Minutes+Cint(row(“Duration”).ToString.Split(":“c)(0))
Minutes=Minutes+Cint(row(“Duration”).ToString)

you have mentioned three minutes
TotalTime=Hours+”:"+Minutes.Padleft(2,CChar(“0”))+" "+AMorPM
in this condition which minutes you have wrote.

Hours, Minutes and AMorPM are variables which we assigned.
At each time if that variable is used means its value get updated as per latest use.
E.g. Minutes=Minutes+Cint(row(“Duration”).ToString) this will be our last statement for minute so this value will get used for further use.