• Resolved fsdfbsidfgbsid

    (@fsdfbsidfgbsid)


    First off excellent plugin. When setting the post dates randomly between certain times, is it possible to specify a specific time of the day? Currently it seems you can only pick the days.

Viewing 1 replies (of 1 total)
  • Plugin Author WP All Import

    (@wpallimport)

    Hi @fsdfbsidfgbsid

    When setting the post dates randomly between certain times, is it possible to specify a specific time of the day?

    Not within our UI, but you could do it with a custom PHP function: https://www.wpallimport.com/documentation/advanced/execute-php/. Here’s an example function:

    function my_get_random_date( $start, $end, $time ) {
    	$start = strtotime( $start );
    	$end = strtotime( $end );
    	$random_date = mt_rand( $start, $end );
    	$final_date = date( "Y-m-d", $random_date ) . " " . $time;
    	return $final_date;
    }

    Example usage:

    [my_get_random_date("2019-07-01","2019-07-12","12:00:00")]

    This would be used in the “As specified” field: https://d.pr/i/8Ndq4q.

    Keep in mind that there’s no error checking in the example, so you have to use proper date/time formats or modify the code.

Viewing 1 replies (of 1 total)
  • The topic ‘Random dates: add specific time?’ is closed to new replies.