In Siemens PCS 7, you can extract the day of the month from the date value stored in the CLK data block by using the following formula:
DayOfMonth := (DT_DATE AND %MDAY) + 1
The DT_DATE function reads the current date and time from the system clock. The %MDAY mask is used to extract the day of the month from the date value. Finally, the + 1 at the end is used to convert the zero-based day of the month to a one-based value, so the result will be in the range of 1 to 31.
You can then use the DayOfMonth variable in your program to perform any desired operations or control logic based on the current day of the month.