Subtract method can not use in date time

Hi,

I wan to use subtract method for dates so i took 2 variables as datetime datatype and get today’s date in one variable and passed a default date in second variable:

i used one assign activity and use subtract method hence it is showing me error like this:
value of type “system.timespan” can not be converted to ‘date’

Please suggest

Hi @nsharma,

Subtract method takes argument of type System.TimeSpan.

Use Now.TimeOfDay which returns the TimeSpan object

Thanks,
Madhura

@Madhuraj is it not possible to use subtract method for date only?

When i am using Now.TimeOfDay it is also showing me error that “timespan can not be converted to date”
am i supposed to change data type for today variable?

@nsharma

You can use following code

dt1.Subtract(dt2).TotalDays

2 Likes

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