Class CTimestamp
CTimestamp represents a timestamp.
Part of this class was adapted from the ADOdb Date Library ADOdb abstraction library. The original source code was released under both BSD and GNU Lesser GPL library license, with the following copyright notice: Copyright (c) 2000, 2001, 2002, 2003, 2004 John Lim All rights reserved.
This class is provided to support UNIX timestamp that is beyond the range of
1901-2038 on Unix and1970-2038 on Windows. Except CTimestamp::getTimestamp()
, all
other methods in this class can work with the extended timestamp range. For
CTimestamp::getTimestamp()
, because it is merely a wrapper of mktime http://php.net/manual/en/function.mktime.php,
it may still be subject to the limit of timestamp range on certain platforms.
Please refer to the PHP manual for more information.
Copyright: 2008-2013 Yii Software LLC
License: http://www.yiiframework.com/license/
Author: Wei Zhuo <weizhuo[at]gmail[dot]com>
Since: 1.0
Located at x2engine/framework/utils/CTimestamp.php
public static
integer
|
#
getDayofWeek( integer $year, integer $month, integer $day )
Gets day of week, 0 = Sunday,... 6=Saturday. Algorithm from PEAR::Date_Calc |
public static
boolean
|
#
isLeapYear( integer $year )
Checks for leap year, returns true if it is. No 2-digit year check. Also handles julian calendar correctly. |
protected static
integer
|
#
digitCheck( integer $y )
Fix 2-digit years. Works for any century. Assumes that if 2-digit is more than 30 years in future, then previous century. |
public static
integer
|
|
public static
integer
|
|
public static
array
|
|
public static
boolean
|
#
isValidDate( integer $y, integer $m, integer $d )
Checks to see if the year, month, day are valid combination. |
public static
boolean
|
#
isValidTime( integer $h, integer $m, integer $s, boolean $hs24 = true )
Checks to see if the hour, minute and second are valid. |
public static
string
|
#
formatDate( string $fmt, integer|boolean $d = false, boolean $is_gmt = false )
Formats a timestamp to a date string. |
public static
integer|float
|
#
getTimestamp( integer $hr, integer $min, integer $sec, integer|boolean $mon = false, integer|boolean $day = false, integer|boolean $year = false, boolean $is_gmt = false )
Generates a timestamp. This is the same as the PHP function mktime http://php.net/manual/en/function.mktime.php. |