Value of type 'Date' cannot be converted to 'Boolean'

Hi there,

Im looking to call a Variable type DateTime into an ‘If’ Activity, however the error message from the title above shows up.

I would like to get some help here.

Thanks.

Hey,
What condition do you want to apply
Please make it clear

Thanks

I want to create a condition that if detects a date from yesterday the activity will Kill the process.

Hey

You can store yesterday’s date in a variable

dateVar=now.AddDays(-1).ToShortDateString.Replace(“/”,“.”) or now.AddDays(-1).ToString(“dd.MM.yyyy”)

Where dateVar is a variable

Then you can compare in if else condition activity
Lasttime. Equals(dateVar)
Then
Kill process activity

Thanks

like this?

Just keep it

now.AddDays(-1).ToShortDateString.Replace(“/”,“.")

Thanks

Hey @jose.sanchez

Please try the below.

lastTime = Now.AddDays(-1)

Hope that helps

Thanks
#nK

Hello @jose.sanchez

My understanding is you want to validate the variable named lastime has yesterday’s date. if it has then, you want to kill the process. If this your scenario then please check the attached workflow for ref

Example.zip (2.8 KB)

Hello @jose.sanchez

If condition will except either True or False condition. You as per your requirement you need to check the lastime is equal to yesterdays date. Can you please provide the format of the date in the lastime variable? Also is it a Datetime variable?

You can do as below.

Now.AddDays(-1).ToString(“dd/MM/yyyy”)

dd/MM/yyyy : you can change this format based on yours.