ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:datetime:custom_dst

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
v5:datetime:custom_dst [2016/04/14 01:37] – created mnewnhamv5:datetime:custom_dst [2023/05/18 18:51] (current) – Deprecated dregad
Line 1: Line 1:
 ====== Daylight Savings Time ====== ====== Daylight Savings Time ======
 +~~NOTOC~~
 +<WRAP right box>
 +== Syntax ==
 +  void adodb_daylight_sv(
 +        array &$dateStructure,
 +         bool $isGmt
 +        )
 +</WRAP>
  
-Allow you to define your own daylights savings function, adodb_daylight_sv. +<WRAP important> 
-If the function is defined (somewhere in an include), then you can correct for daylights savings+[[datetime_index#deprecated|Deprecated]] since ADOdb 5.22.6, and [[https://github.com/ADOdb/ADOdb/issues/970|removed in 5.23.0]]. 
- +Use 64-bit native PHP functions instead. 
-In this example, we apply daylights savings in June or July, adding one hour. This is extremely +</WRAP> 
-unrealistic as it does not take into account time-zone, geographic location, current year.+     
 +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
 +------------------------- 
 +===== Usage ===== 
 +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.
  
 <code php> <code php>
-function adodb_daylight_sv(&$arr, $is_gmt)+function adodb_daylight_sv(&$dateStructure, $isGmt)
 { {
- if ($is_gmt) return; +    if ($isGmt 
- $m = $arr['mon']; +        return; 
- if ($m == 6 || $m == 7) $arr['hours'] += 1;+    $m = $dateStructure['mon']; 
 +    if ($m == 6 || $m == 7)  
 +        $dateStructure['hours'] += 1;
 } }
 </code> </code>
Line 18: Line 32:
 This is only called by adodb_date() and not by adodb_mktime(). This is only called by adodb_date() and not by adodb_mktime().
  
-The format of $arr is+===== The Date Structure ===== 
 +The format of $dateStructure is
   Array (   Array (
    [seconds] => 0    [seconds] => 0
v5/datetime/custom_dst.1460590659.txt.gz · Last modified: 2017/04/21 11:26 (external edit)