I want to add date control in the program, set the initial date of 2024-11-1 for the variable tm, obtain the current date when the program starts, compare the two dates, and exit the app if the current date is greater than tm。
I think the OP means block the user to use the app after a trial period.
Based on my knowledge, there is no fool proof way to do it. A user may change the system time to fool this logic.
If that really is all that you want to do then you could use a server with access to UTC time to record the installation date and disable the app if the trial period is exceeded. But this would not prevent the user uninstalling and reinstalling the app for a new time period. If, as @aeric suggests, your aim is to prevent that then this simple scheme will not work - you need to provide some additional assets, like extra game levels or more functions or a larger database, if you want to get someone to pay for your app.
There are ways like reading the device unique id like the advertising id or uuid, hardware serial number or MAC address to counter the misuse. A cracker can also reverse engineering or decompile the code and then remove the checking code.