How to Trigger WP CRON at Local Timestamp?

Part 1. The Time != The Timestamp

enter image description here

This is your problem:

every midnight at Local Timestamp

There is no such thing as a local timestamp. Timestamps are not timezoned, it’s not that WP uses UTC, but rather that UTC timestamps just happen to be +0 hours.

If you want it to happen at midnight local time, you need to convert that time into a timestamp, and UTC is the easiest way to do that. For example midnight BST is 11pm UTC, so I would need to schedule a cron job for 11pm for it to run at midnight. If I set the cron job to run at 00:00, then that would be 1am local time, which is not what I wanted.

So take your desired localized timezoned time, and convert it to UTC in code. You can always undo the math at a later date if you need to display it.

e.g. here we take a UTC date and change it to Moscow time:

$date = new DateTime('2012-07-16 01:00:00 +00');
$date->setTimezone(new DateTimeZone('Europe/Moscow')); // +04

echo $date->format('Y-m-d H:i:s'); // 2012-07-15 05:00:00 

And here we take a Bangkok time and convert it to UTC:

$given = new DateTime("2014-12-12 14:18:00 +07");
echo $given->format("Y-m-d H:i:s e") . "\n"; // 2014-12-12 14:18:00 Asia/Bangkok

$given->setTimezone(new DateTimeZone("UTC"));
echo $given->format("Y-m-d H:i:s e") . "\n"; // 2014-12-12 07:18:00 UTC

If you still want to specify things in local time just write a function to do the conversion, e.g. $utc_time = convert_to_utc( "time in local timezone")

Part 2. Why UTC?

Have you ever noticed why some timezones are referenced as +8 hours or -2? That would be UTC+8 or UTC-2. UTC is also known as coordinated universal time.

It’s the time system used as the base standard that all the usual time systems we use day to day are derived from. So your local time is defined as some offset of UTC.

So Can I make WP use the local timezone for timestamps?

If WP stored everything using local time, then changing your local time would involve modifying every timestamp in the database. It would cause issues with communications with other APIs. It would also cause issues with plugins and themes that try to convert from UTC to your local timezone, doubling the offset, and causing compounding errors. It could also cause issues with the REST API, 2 factor auth, etc

It’s a very bad idea. It also breaks the fundamental system of a timestamp on your site.

Think of it this way. You see times and dates in WordPress with a timezone modifier attached. When WP stores the data, it strips away the modifier, and stores it as a standardised value that all WP sites and computers understand. It then re-applies the timezone modifier whenever it displays the date.