Ad Code

Calculating remaining days in a month

You can use strtotime and date.
For the format of date you can use the following:
't' Number of days in the given month (28 through 31)
'j' Day of the month without leading zeros (1 to 31)
<?php

$timestamp = strtotime('2014-10-03');

$daysRemaining = (int)date('t', $timestamp) - (int)date('j', $timestamp);

var_dump($daysRemaining); // int(28)

Post a Comment

0 Comments