using weekday function shows #VALUE! in cell

In libreoffice calc, I am trying to use the following formula to return a number for the day of the week so that I can format the cell to show the day (e.g. Friday), but instead I get #VALUE! in the cell:

=Weekday(Sheet2.A1,1)

Sheet 2 cell A1 contains the following, in ‘date format’: 28-03-2021

The weekday function does not work when using referenced cells but works when using the text within the formula as shown below:

=Weekday(28-03-2021,1)

What am I doing wrong?

I bet that Sheet2.A1 contains a string, and also =Weekday(28-03-2021,1) likely does not what you expect it to.

You are absolutely right! I did not have it in the correct date format. I got it to work now, thank you for your help!