Why is there no subtractMinutes, subtractMonths, etc. function?
2
Recently the addMinutes, addMonths, etc. functions were added. Why is there no subtractMinutes, subtractMonths, etc. functions? Is there an alternative way to calculate what the time was 60 minutes ago? I'm trying to set the datetime attribute of an entity to the time it was 60 minutes ago.
asked
Andrew Whalen
2 answers
7
You can use a negative number to subtract minutes etc. from a DateTime value.
Example: addMinutes($dateTimeValue, -60)
answered
Benny van Reeven
5
Try using the functions with negative numbers, like: