Time in PHP format

Asked

Viewed 114 times

4

am creating a wordpress function to schedule events in the following way:

add_action( 'wp', 'prefix_setup_schedule' );
function prefix_setup_schedule() {
    if ( ! wp_next_scheduled( 'send_email' ) ) {
        wp_schedule_event( time(), 'daily', 'send_email');
    }
}

Except that this team would have to be at 6:00 and not the time that was recorded, so I wanted to make it take the current day and the time always at 6:00 in this format of the team so that there are no problems in the function;

Some solution?

1 answer

6


The function time() returns the timestamp current. If you want to create a timestamp at 18h of the current date, the code of the time() would be so:

strtotime(date("Y-m-d 18:00:00"));
  • That’s right, thanks @Amauri :D

  • 2

    I hope I’ve helped, don’t forget to mark the answer as answered in case it went all right, Abs

Browser other questions tagged

You are not signed in. Login or sign up in order to post.