How to create a variable with yesterday's day name?

Is there a way to subtract from a system variable such as $dayOfWeekName to make the value be yesterday? How would I accomplish this? Thanks

This example assumes you are attempting to get a string variable as a result.

Not sure you can simply do Wednesday - 1 = Tuesday. However, you could create a switch statement based upon the variable $dayOfWeek = number (Example: 5). 1 = Monday.

So if Monday = 1

Switch $dayOfWeek
Case 1:
@yesterdayVariable = Sunday
Case 2:
@yesterdayVariable = Monday


Another option is to use a piston that executes daily at 23:59 (maybe a little earlier in case there is a delay executing the piston) and sets a global variable to $dayOfWeekName. That global variable will now be yesterday’s value.

For simplicity’s sake I tried this method. It’s working great, thanks for the idea!

I think there is a function to get the name of the day, and you could pass addDays($now, -1) to it. Or I think this should do the trick too: