Current datetime and change time part to hardcoded value in C code

How to get current datetime and change the time part only to 10PM in datetime -> in C language code?
For ex. 01-Sep-21 10:00:00 PM

Can someone please help with code snippets on this.