In the grand scheme of things this is trivial, but it was a quick solution to my problem at hand. This is an inline insertion that generates a string made up of the current month and year, and if later than the ides of the current month, inserts the next month and the year for that month in place of the current year.
It's very useful for a calendar that rolls into view as the weeks progress.PHP Code:function titleDate()
{
$str = date("F",strtotime("this month"));
if (date("d") > 15)
{
$str .= " - " . date("F Y",strtotime("next month"));
} else {
$str .= " " . date("Y",strtotime("this year"));
};
echo $str;
};
Submit Your Article
Forum Rules

Reply With Quote