Database Abstraction Layer for PHP

User Tools

Site Tools


Daylight Savings Time

void adodb_daylight_sv(
      array &$dateStructure,
       bool $isGmt

Deprecated since ADOdb 5.22.6, and removed in 5.23.0. Use 64-bit native PHP functions instead.

Currently, the ADOdb date/time library has no built-in support for Daylight Savings Time, but provides a simple hook that allows you to define your own daylights savings function. The function must be called adodb_daylight_sv(), and must be accessible in the current procedure.


In this example, we apply daylights savings in June or July, adding one hour. This is extremely unrealistic as it does not take into account time-zone, geographic location, current year.

function adodb_daylight_sv(&$dateStructure, $isGmt)
    if ($isGmt) 
    $m = $dateStructure['mon'];
    if ($m == 6 || $m == 7) 
        $dateStructure['hours'] += 1;

This is only called by adodb_date() and not by adodb_mktime().

The Date Structure

The format of $dateStructure is

Array (
 [seconds] => 0
 [minutes] => 0
 [hours] => 0
 [mday] => 1      # day of month, eg 1st day of the month
 [mon] => 2       # month (eg. Feb)
 [year] => 2102
 [yday] => 31     # days in current year
 [leap] =>        # true if leap year
 [ndays] => 28    # no of days in current month
v5/datetime/custom_dst.txt · Last modified: 2023/05/18 18:51 by dregad