The file demonstrates the difference between value and formatting.
Enter an ISO date in B5 order to make it work with any locale. “5.MäR.2024” works with German locale only. Enter “2024-3-5” instead. B5 is formatted as text (format code @). Anything you enter into that cell is treated literally.
D5 and D6 convert the text in B5 into a number.
WEEKDAY(D5) extracts the weekday number 3 from D5. The number format NNN (show weekday name) displays Tuesday for the number 3 which is totally wrong although it looks right. The day number 3 on Calc’s time scale happened to be a Tuesday just like 2024-03-05, but day number 3 was 1900-01-02. This happens to return the same weekday unless you change the calculation mode of the WEEKDAY function. WEEKDAY(D2;2) returns 2 (Monday=1) and the number format displays “Monday” for number 2 because Calc’s day number 2 (1900-01-01) was a Monday indeed. Never format any month number, year number or weekday number!
Cell E5 does it right. By reference it has the exact same cell value as D5. The number format “NNN” displays the correct weekday name, but this time it displays the weekday name of 2024-3-5 which is day number 45356.
G5 does the same. It references the same value 45356 in D5 and formats this number as DD showing the 2-digit day portion of the date. So does H5, I5 and J5. E5:J5 share the exact same value 45356. Due to formatting, they display only a partial information about the actual value.
The other part demonstrates how the WEEKDAY converts the date in D5 using different values for the second argument. See documentation on WEEKDAY