PHP, strtotime and weeks over new year problems

Having problems with navigating over new year with weeks and think it's a bug? You are not alone, a friend of mine also thought so :-) There is a problem how to deal with starting days of week, Sunday or Monday causing the problem.

Problem: based on a date adding a week or 7 days (+1 week or +7 days) causing "20121224 +1week" end up on "20121231" if you set "Ymd" but if you go for "YW" you get "201201". If you instead use the ISO year "o" you will get the right year.

Workaround warnings like "It is not safe to rely on the system's timezone settings..." using strtotime() and date()

When running cron.php from CLI you might get a warning like "It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CEST/2.0/DST' instead ..."

Best solution is to set the time zone in the CLI version of php.ini, suggested in

Add a monthly datepicker with jQuery - separate script

This script adds a month-year picker to a text field, and works better than a modification of jQuery datepicker.

(drupal_get_path('module', 'jquery_ui') .'/jquery.ui/ui/jquery.mtz.monthpicker.js');

$sub_script = "$(document).ready(function () {
            'pattern': 'mm/yyyy'
        }); "

drupal_add_js($script, 'inline', 'footer');