- Home
- About
- Testimonials
- Demos
- Download
- Documentation
- Blogs
- Forum
- Support

Packages: default System System.Caching System.Collections System.Data System.Data.ActiveRecord System.Data.ActiveRecord.Relations System.Data.ActiveRecord.Scaffold System.Data.ActiveReecord.Scaffold.InputBuilder System.Data.Commom.Sqlite System.Data.Common System.Data.Common.Mssql System.Data.Common.Mysql System.Data.Common.Oracle System.Data.Common.Pgsql System.Data.Common.Sqlite System.Data.DataGateway System.Data.SqlMap System.Data.SqlMap.Configuration System.Data.SqlMap.Statements System.Exceptions System.I18N System.IO System.Security System.Util System.Web System.Web.Services System.Web.UI System.Web.UI.ActiveControls System.Web.UI.WebControls System.Web.UI.WebControls.assets System.Xml Classes: TBrowserLogRoute TDataFieldAccessor TDateTimeStamp TDbLogRoute TEmailLogRoute TFileLogRoute TFirebugLogRoute TFirePhpLogRoute TLogger TLogRoute TLogRouter TParameterModule TSimpleDateFormatter TVarDumper |
Keyword
# Class TDateTimeStamp
TDateTimeStamp Class TDateTimeStamp Class is adpated from the ADOdb Date Library, part of the ADOdb abstraction library Download: http://phplens.com/phpeverywhere/ http://phplens.com/phpeverywhere/adodb_date_library PHP native date functions use integer timestamps for computations. Because of this, dates are restricted to the years 1901-2038 on Unix and 1970-2038 on Windows due to integer overflow for dates beyond those years. This library overcomes these limitations by replacing the native function's signed integers (normally 32-bits) with PHP floating point numbers (normally 64-bits). Dates from 100 A.D. to 3000 A.D. and later have been tested. The minimum is 100 A.D. as <100 will invoke the 2 => 4 digit year conversion. The maximum is billions of years in the future, but this is a theoretical limit as the computation of that year would take too long with the current implementation of getTimeStamp. PERFORMANCE For high speed, this library uses the native date functions where possible, and only switches to PHP code when the dates fall outside the 32-bit signed integer range. Since: 3.0.4 Author: Wei Zhuo <weizhuo[at]gmail[dot]com>
Method Summary
protected integer | digitCheck ( mixed $y) Fix 2-digit years. Works for any century.
string | formatDate ( mixed $fmt, mixed $d, mixed $is_gmt)
void | get4DigitYear ( mixed $y)
array | getDate ( mixed $d, mixed $fast)
void | getDayofWeek ( mixed $year, mixed $month, mixed $day) Gets day of week, 0 = Sunday,... 6=Saturday.
integer | getGMTDiff ()
integer|float | getTimeStamp ( mixed $hr, mixed $min, mixed $sec, mixed $mon, mixed $day, mixed $year, mixed $is_gmt) Not a very fast algorithm - O(n) operation. Could be optimized to O(1).
boolean | isLeapYear ( float $year) Checks for leap year, returns true if it is. No 2-digit year check. Also handles julian calendar correctly.
boolean | isValidDate ( mixed $y, mixed $m, mixed $d)
protected array | _getDateInternal ( float $origd, boolean $fast, boolean $is_gmt) Low-level function that returns the getdate() array. We have a special $fast flag, which if set to true, will return fewer array values, and is much faster as it does not calculate dow, etc.
Method Details
## digitCheck
protected integer digitCheck | (mixed $y )
Fix 2-digit years. Works for any century. Assumes that if 2-digit is more than 30 years in future, then previous century.
Input
mixed | $y |
Output
integer | change two digit year into multiple digits
Exception
## formatDate
public string formatDate | (mixed $fmt , mixed $d , mixed $is_gmt )
Input
mixed | $fmt |
mixed | $d |
mixed | $is_gmt |
Output
string | formatted date based on timestamp $d
Exception
## get4DigitYear
public void get4DigitYear | (mixed $y )
Input
mixed | $y |
Output
Exception
## getDate
public array getDate | (mixed $d , mixed $fast )
Input
mixed | $d |
mixed | $fast |
Output
array | an array with date info.
Exception
## getDayofWeek
public void getDayofWeek | (mixed $year , mixed $month , mixed $day )
Gets day of week, 0 = Sunday,... 6=Saturday. Algorithm from PEAR::Date_Calc
Input
mixed | $year |
mixed | $month |
mixed | $day |
Output
Exception
## getGMTDiff
public integer getGMTDiff | ()
Output
integer | get local time zone offset from GMT
Exception
## getTimeStamp
public integer|float getTimeStamp | (mixed $hr , mixed $min , mixed $sec , mixed $mon , mixed $day , mixed $year , mixed $is_gmt )
Not a very fast algorithm - O(n) operation. Could be optimized to O(1).
Input
mixed | $hr |
mixed | $min |
mixed | $sec |
mixed | $mon |
mixed | $day |
mixed | $year |
mixed | $is_gmt |
Output
integer|float | a timestamp given a local time. Originally by jackbbs.
Exception
## isLeapYear
public boolean isLeapYear | (float $year )
Checks for leap year, returns true if it is. No 2-digit year check. Also handles julian calendar correctly.
Input
float | $year | year to check
Output
boolean | true if is leap year
Exception
## isValidDate
public boolean isValidDate | (mixed $y , mixed $m , mixed $d )
Input
mixed | $y |
mixed | $m |
mixed | $d |
Output
boolean | true if valid date, semantic check only.
Exception
## _getDateInternal
protected array _getDateInternal | (float $origd , boolean $fast , boolean $is_gmt )
Low-level function that returns the getdate() array. We have a special $fast flag, which if set to true, will return fewer array values, and is much faster as it does not calculate dow, etc.
Input
float | $origd | original date
boolean | $fast | false to compute the day of the week, default is true
boolean | $is_gmt | true to calculate the GMT dates
Output
array | an array with date info.
Exception