Add time to TimeVariable

Hi Team, i Hope all doing good there!.

I have a time variable Vstarttime output is 01:00 i want to add 46mins to the starttime sting with UiPath

1 Like

Hi

Hope the below expression would help you resolve this

stroutput = Datetime.ParseExact(Strinput.ToString.Trim, “hh:mm”, System.Globalization.CultureInfo.InvariantCulture).AddMinutes(46).ToString(“hh:mm”)

Cheers @rahul_gola

you can do the suggestion from Palaniyappan
you can also try this:
Vstarttime.add(New System.Timespan(0,0,46,0))

here Vstarttime is of type TimeSpan

grafik

@Palaniyappan, Thank you for quick response. but the above is not working i am not getting ParseExact

Can u show the error you are getting @rahul_gola

its a string, is that is why i am not able to identify as time.

i am reading a json file and getting start time from there. but when i am tryin gthe above expression its not working

it says ParseExact is not a member of string

@rahul_gola

Can you please show us the expression you are using here.

@lakshman @Palaniyappan vstartTime = TestObject(“data”)("@StartTime").ToString

output is 00:16

now i want to add 46 mins to it

1 Like

Fine
addtime.zip (2.1 KB)

Here you go with a sample xaml

Cheers @rahul_gola

image

stringinput is ok i will pass it but same error

Is the same error as above or different one @rahul_gola

same error as the above

@rahul_gola

Try below expression.

       CDate(TestObject(“data”)("@StartTime").ToString).AddMinutes(46).ToString("HH:mm")

Thanks @lakshman, This worked.

1 Like

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