How to subtract days from a date?
Hi,
I'm trying to subtract days from a date but it gives me the following error when I try to print the report:
txtPrevLib: Error in expression: AddDays([Project.DaysToFinish], -30)
AddDays works perfect if I use a positive number, but I need to subtract days.
Thanks very much!
This discussion has been closed.
Comments
Hello!
Recommended expression, checking for a null date and explicitly casting to DateTime:
[IIf(IsNull(‘Orders.OrderDate’) || ((DateTime)[Orders.OrderDate]). Year <= 1, ‘N/A’, FormatDateTime(AddDays((DateTime)[Orders.OrderDate], -30), ‘yyyy-MM-dd’))]For a non-nullable DateTime column, the following is sufficient:
[AddDays([Orders.OrderDate], -30)]