PHP Date Quirks

Get Monday of the week; this sript is handy if you want to be able to display the current week’s dates. just specify a date.

function getMonday($date){
    if(date('N', strtotime($date)) == 7){
        $date = date('Y-m-d', strtotime("-1 days", strtotime($date)));
    }
    return date('Y-m-d', strtotime("this week monday", strtotime($date)));
}

function getSunday($date){
    if(date('N', strtotime($date)) == 7){
        $date = date('Y-m-d', strtotime("-1 days", strtotime($date)));
    }
    return date('Y-m-d', strtotime("this week sunday", strtotime($date)));
}
echo "Start: ".getMonday('2014-08-22');
echo "End: ".getSunday('2014-08-22');

Amiel Simbahon

Amiel Simbahon
Software Maker

Option Page for your Plugin or Theme

How to add option page to your plugin or theme. Continue reading

Wordpress Ajax Frontend

Published on February 21, 2017

Human Readable Filesize

Published on February 21, 2017