Metro_Sitemap::get_date_stamp PHP Method

get_date_stamp() public static method

Get properly formatted data stamp from year, month, and day
public static get_date_stamp ( integer $year, integer $month, integer $day ) : string
$year integer
$month integer
$day integer
return string formatted stamp
    public static function get_date_stamp($year, $month, $day)
    {
        return sprintf('%s-%s-%s', $year, str_pad($month, 2, '0', STR_PAD_LEFT), str_pad($day, 2, '0', STR_PAD_LEFT));
    }

Usage Example

function vipgo_generate_sitemap_for_year_month_day($args)
{
    $year = $args['year'];
    $month = $args['month'];
    $day = $args['day'];
    $date_stamp = Metro_Sitemap::get_date_stamp($year, $month, $day);
    if (Metro_Sitemap::date_range_has_posts($date_stamp, $date_stamp)) {
        Metro_Sitemap::generate_sitemap_for_date($date_stamp);
    } else {
        Metro_Sitemap::delete_sitemap_for_date($date_stamp);
    }
}
All Usage Examples Of Metro_Sitemap::get_date_stamp