Sat 27 Dec 2003

BST Checking

I thought I'd share my code for BST checking, as I just got round to fixing it!
It's pretty simple; work out the date ranges for the year, then check if the date is between them.
function isBST($now) {
$ThisYear = gmdate("Y", $now);
$MarStartDate = ($ThisYear."-03-25");
$OctStartDate = ($ThisYear."-10-25");
$MarEndDate = ($ThisYear."-03-31");
$OctEndDate = ($ThisYear."-10-31");
while ($MarStartDate <= $MarEndDate) {
$day = date("l", strtotime($MarStartDate));
if ($day == "Sunday") {
$BSTStartDate = ($MarStartDate);
}
$MarStartDate++;
}
$BSTStartDate = (date("U", strtotime($BSTStartDate))+(60*60));
while ($OctStartDate <= $OctEndDate) {
$day = date("l", strtotime($OctStartDate));
if ($day == "Sunday") {
$BSTEndDate = ($OctStartDate);
}
$OctStartDate++;
}
$BSTEndDate = (date("U", strtotime($BSTEndDate))+(60*60));

return (($now >= $BSTStartDate) && ($now <= $BSTEndDate));
}
Pass in a time (e.g. from mktime) et voila!

Posted at 2003-12-27 09:26:25 by RichardLink to BST Checking

Updates and improvements

Continuing my run of breaking my wrists working on this site, I've added my C++ course notes, a proper rendition of the notes I've taken for CS2A2, and a publications page (currently empty).
I've also made the front page a little more information rich (for Google's benefit really), and removed the rubbish picture (which was breaking up the flow). A few CSS improvements in the mix too.

My Dell's HDD has bitten the dust; won't spin up, and therefore stops the whole IDE channel from working: me-no-booty. I've lost a bit of stuff, but I have a full Windows backup from 3rd October and some mail backups from a little while ago.
It's still annoying.
Come on Dell, reply to me. It's under 3-year next-business-day on-site kiss-my-ass warranty!

Posted at 2003-12-27 08:58:01 by RichardLink to Updates and improv…