Checking if a UK date is in the past with PHP

The easiest way to check if a date is in the past with PHP is using strtotime but unfortunately it only understands US and Unix date formats, not the UK’s format d/m/Y.

A UK date string therefore needs to be transformed first. You will need to use a regular expression to first validate that your UK date is valid. I do not set this out here. Once you are sure you have a UK valid date string of the format d/m/Y, e.g. 01/02/2010 you can do the following:

// tests a uk date string for being in the past. time components will be midnight for test to work.
function is_uk_date_in_past($pre_validated_uk_date_string_no_time) {
    list($d, $m, $y) = explode('/', $pre_validated_uk_date_string_no_time);
    $today = strtotime(date("Y-m-d")); // we do not define today as time() as that will include the current time
    $given = strtotime("{$y}-{$m}-{$d}");
    return $given >= $today;
}

QuickTime X Question Mark for Video in Safari, Firefox

Just recently, and I cannot quite be certain when, video on some websites I use stopped playing in Safari and Firefox on my Mac instead being replaced by a QuickTime logo with a question mark. There are plenty of folk experiencing the same issue but no real answer. The most suggested fix is to repair permissions but this is not what my issue was.

I finally found that the video streams in question are Windows Media Video streams. QuickTime does not play the format and so gives the question mark.

To fix this issue I just installed the free version of the Flip4Mac WMV Player which installs the appropriate codecs/plugin for QuickTime X.

Now I can get on with watching the NASA Ares launch.