Help

Trying to substract days from a date

1449 6
cancel
Showing results for 
Search instead for 
Did you mean: 
Patrice_Laporte
5 - Automation Enthusiast
5 - Automation Enthusiast

Hello
I want to anticipate date based on certain selection. So when you select an option in the single select field it output a specific number of days in {Style délais} and update a date field
I’m still getting #ERROR! and without a debugging console I can’t see where is the problem

Date de livraison = date field
Style délais = integer formula field (based on a single select field)

DATETIME_PARSE(DATEADD({Date de livraison} - {Style délais}, ‘days’), ‘D MMM YYYY’)

6 Replies 6

In DATEADD you have separated the 2 parameters with -, you need a comma.

Thank you Elias it’s acting as an operator.
Date de livraison - Style délais
otherwise
21/7/18 - 20 days = 1/7/18

Two issues:

  1. As @Elias_Gomez_Sainz notes, DATEADD() requires three parameters. To subtract a certain number of days, you would make the second parameter negative, as so:

    DATEADD({Date de livraison}, -{Style délais}, 'days')

  2. DATEADD() returns a date, while DATETIME_PARSE() expects a string input. If you’re trying to format the date into 'D MMM YYYY' format, use DATETIME_FORMAT() instead.

I was doing this:

e2c816acaacdadcc53d1ddebfabe5687f1d2977f.png

Formula:

DATEADD(Date, Days, 'day')

Negative

36ff765e4187ccbecfd58471990c101e3a34ddca.png

Formula:

DATEADD(Date, -Days, 'day')

It’s all clearer after a night sleep.
Date parsing was also useless.
Thank You Elias I strip it down to the basics and it works.
DATEADD({Date de livraison},-({Style délais}),‘d’)