ARTLUNG LAB Share

Created 07/2011

Countdown in to the first of the month in PHP

Result

It is 9 days until the first!

Source Code:

<?php
    $today = strtotime('today');
    $day_of_month = (int)date('j', $today);
    $days_in_this_month = (int)date('t', $today);
    $days_until_the_first = $days_in_this_month - $day_of_month;
    print "It is {$days_until_the_first} days until the first!";
?>