How do get the date of last saturday?

how do get the date of last saturday ?

Hi,

this is a possible solution:

ifelse(
extract(‘WD’,now())=1,addDateTime(-1,‘DD’,now()), /sunday/
extract(‘WD’,now())=2,addDateTime(-2,‘DD’,now()), /monday/
extract(‘WD’,now())=3,addDateTime(-3,‘DD’,now()), /tuesday/
extract(‘WD’,now())=4,addDateTime(-4,‘DD’,now()), /wednesday/
extract(‘WD’,now())=5,addDateTime(-5,‘DD’,now()), /thursday/
extract(‘WD’,now())=6,addDateTime(-6,‘DD’,now()), /friday/
extract(‘WD’,now())=7,addDateTime(-7,‘DD’,now()),NULL /saturday/
)

I use extract to check which weekday is today and go specific days in the past to the last saturday.

If today is saturday and you want to get todays date, then you have to remove the last check or change addDateTime(-7,‘DD’,now()) to now().

Thomas

1 Like

Hi Thosmas @thomask @todd.hoffman

Thanks for the response however there is an error which says check syntax of extract.

Also,
today is 3rd January, 2023 last saturday date is 31st December 2022.

and i want this output of the calculated field to show 31st december 2022.
How do i do this ? Can you please help me with this ?

My bad it is working, thank you so much <3

1 Like