Add 23 hours 59 minutes and 59 seconds to meta key before saving?

I have a plugin which has a datepicker in the post, and saves this date as unix epoch to visitor-date. Problem is that it always saves everything as the same time 00:00:00 and I want it to be saved as 23:59:59.

The code looks like this:

if ( isset( $_POST[‘vs-date’] ) ) {
update_post_meta( $post_id, ‘visitor-date’, sanitize_text_field(strtotime( $_POST[‘vs-date’] ) ) );
}

What it does it that it check if ´vs-date´ is set, and if it is, it converts it to unix epoch format and saves it to the ´visitor-date´ metakey.

Is it possible to add +86399 seconds to the epoch before saving it to ´visitor-date´?

Read more here:: Add 23 hours 59 minutes and 59 seconds to meta key before saving?

Leave a Reply

Your email address will not be published. Required fields are marked *