DirectAdmin Backup Week of Month

<?php

function DABackupWeekOfMonth ($time)
{
    $firstDateOfMonth = date('Y-m-01', $time);
    $firstDayOfMonth = intval(date('N', strtotime($firstDateOfMonth)));
    $firstDayOfMonth %= 7; // make Sunday as 0 (7 -> 0)
    $date = intval(date('d', $time));
    return ceil(($date + $firstDayOfMonth) / 7);
}
Posted in PHP

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.