Free web development scripts for the webmasterDevelopment Scripts

 social media marketing services
 Site Navigation
Clicky Web Analytics
 o Development Scripts
 o Text Only Edition
 o News
 o Tutorials
 o Register an account
 o New entries this week
 o Affiliates/Links
 o Contact Us
 o About us
 o Advanced Search

 Browse Path
 o 1 user online
 o Most users online: 67
 o Home
  o PHP
   o Miscellaneous
    o Script

 Member Login
User Name

Valid XHTML 1.0!

 Recommended Links
 o PHP Freaks
 o Paper Free Invoicing
 o Tutorials
 o Expired Domain Crawler

British Summer Time? (BST) (Rated 4)


This PHP function will let you know if we are currently in British Summer Time.

Sounds useless doesn't it. Trust me, it has some uses. For example some British hosting companies keep their servers set to GMT and do not adjust for BST. The reason being is that it would be unfair on their international clients. Fair enough.

The European Union has now adopted The Ninth European Parliament and Council Directive on Summer Time Arrangements in which it states that British Summer (or daylight saving) time will be kept between the last Sunday in March to the last Sunday in October. The changes will take place at 1am GMT.

Code starts here

// declare some start variables
$ThisYear = (date("Y"));
$MarStartDate = ($ThisYear."-03-25");
$OctStartDate = ($ThisYear."-10-25");
$MarEndDate = ($ThisYear."-03-31");
$OctEndDate = ($ThisYear."-10-31");

//work out the Unix timestamp for 1:00am GMT on the last Sunday of March, when BST starts
while ($MarStartDate <= $MarEndDate)
$day = date("l", strtotime($MarStartDate));
if (
$day == "Sunday"){
$BSTStartDate = ($MarStartDate);
$BSTStartDate = (date("U", strtotime($BSTStartDate))+(60*60));
"BST this year starts at 1:00am GMT on ";
date("l, dS M", $BSTStartDate);

//work out the Unix timestamp for 1:00am GMT on the last Sunday of October, when BST ends
while ($OctStartDate <= $OctEndDate)
$day = date("l", strtotime($OctStartDate));
if (
$day == "Sunday"){
$BSTEndDate = ($OctStartDate);
$BSTEndDate = (date("U", strtotime($BSTEndDate))+(60*60));
"BST this year ends at 1:00am GMT on ";
date("l, dS M", $BSTEndDate);

//Check to see if we are now in BST
$now = mktime();
if ((
$now >= $BSTStartDate) && ($now <= $BSTEndDate)){
"We are now in BST";
else {
"We are now in GMT";


Submitted by Devscripts on 07-04-2004 9:38

Recent Additions (from all categories)

(PHP) T Shirt Printing Software

(PHP) Youtube Video Organizer Script

(PHP) MP3z - MP3 Search Engine Script

(PHP) Recipez- PHP Recipe Script

(ASP) Stop image hotlinking and downloading. Web image protection is easy with Image Trapper.

Top Rated Scripts

(Javascripts) Javascript Delayed Redirection Rating: 5

(PHP) Random Links and images with PHP & MySQL Rating: 5

(PHP) RSS/XML news feed headline grabber! Rating: 5

(PHP) Random Signatures/Avatars Rating: 5

(Javascripts) Detecting Client Web Browser Rating: 5

© Copyright 2003 -  Web Analytics