Time in PHP format

4

I'm creating a function in wordpress to schedule events as follows:

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

But this team would have to be at 6:00 pm and not the time it was registered, so I wanted to get the current day and time always the 18 in the team format so that there are no problems in the function

Any solution?

    
asked by anonymous 10.04.2014 / 13:56

1 answer

6

The time() function returns the current timestamp . If you want to create a timestamp at 6:00 PM on the current date, the code for time() would look like this:

strtotime(date("Y-m-d 18:00:00"));
    
10.04.2014 / 14:08