Display Yesterday in Format Date

I want to display yesterday's date using FormatDate property of Clock Sensor. How?

These are draggable blocks, directly drag them to your workspace.

1 Like

thanks @Gordon_Lu

1 Like

Yesterday

Tomorrow

3 Likes

Wouldn't it generate error? What if today is 1st February, as

Here, it should have returned 31.

No, it did not.

If there is an error message, just use this empty eevent.

1 Like

Even this works fine.

image

1 Like

No, it's not about the programatical error, output error, as it is comming out as 0 if we subtruct 1 from 1st day of month, it is not returining the last day of privious month.

2 Likes

Yes, it is not returning the last date, it is returning 0. For some reason, the App Inventor system 'checks' if the day is 0, it will return the previous date in the MakeDate event. If you are not using the MakeDate block for specific purposes you can use post #2.

Of course, the subtraction operator itself is returning 0.

1 Like

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