WordPress StrToTime Function

There is times that I am wanting to convert a time string and have it output in the sites timezone. This is a simple function that utilizes the DateTime class and implements the wp_timezone for its output.

function wp_strtotime($str) {
    $datetime = new DateTime($str, wp_timezone());
    return $datetime->format('U');



Posted on

June 3, 2022

Submit a Comment

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