Overview

Packages

  • application
    • commands
    • components
      • actions
      • filters
      • leftWidget
      • permissions
      • sortableWidget
      • util
      • webupdater
      • x2flow
        • actions
        • triggers
      • X2GridView
      • X2Settings
    • controllers
    • models
      • embedded
    • modules
      • accounts
        • controllers
        • models
      • actions
        • controllers
        • models
      • calendar
        • controllers
        • models
      • charts
        • models
      • contacts
        • controllers
        • models
      • docs
        • components
        • controllers
        • models
      • groups
        • controllers
        • models
      • marketing
        • components
        • controllers
        • models
      • media
        • controllers
        • models
      • mobile
        • components
      • opportunities
        • controllers
        • models
      • products
        • controllers
        • models
      • quotes
        • controllers
        • models
      • services
        • controllers
        • models
      • template
        • models
      • users
        • controllers
        • models
      • workflow
        • controllers
        • models
      • x2Leads
        • controllers
        • models
  • Net
  • None
  • PHP
  • system
    • base
    • caching
      • dependencies
    • collections
    • console
    • db
      • ar
      • schema
        • cubrid
        • mssql
        • mysql
        • oci
        • pgsql
        • sqlite
    • i18n
      • gettext
    • logging
    • test
    • utils
    • validators
    • web
      • actions
      • auth
      • filters
      • form
      • helpers
      • renderers
      • services
      • widgets
        • captcha
        • pagers
  • Text
    • Highlighter
  • zii
    • behaviors
    • widgets
      • grid
      • jui

Classes

  • CDateTimeParser
  • CFileHelper
  • CFormatter
  • CLocalizedFormatter
  • CMarkdownParser
  • CPasswordHelper
  • CPropertyValue
  • CTimestamp
  • CVarDumper
  • Overview
  • Package
  • Class
  • Tree

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.

Package: system\utils
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
Methods summary
public static integer
# getDayofWeek( integer $year, integer $month, integer $day )

Gets day of week, 0 = Sunday,... 6=Saturday. Algorithm from PEAR::Date_Calc

Gets day of week, 0 = Sunday,... 6=Saturday. Algorithm from PEAR::Date_Calc

Parameters

$year
integer
$year year
$month
integer
$month month
$day
integer
$day day

Returns

integer
day of week
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.

Checks for leap year, returns true if it is. No 2-digit year check. Also handles julian calendar correctly.

Parameters

$year
integer
$year year to check

Returns

boolean
true if is leap year
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.

Fix 2-digit years. Works for any century. Assumes that if 2-digit is more than 30 years in future, then previous century.

Parameters

$y
integer
$y year

Returns

integer
change two digit year into multiple digits
public static integer
# get4DigitYear( integer $y )

Returns 4-digit representation of the year.

Returns 4-digit representation of the year.

Parameters

$y
integer
$y year

Returns

integer
4-digit representation of the year
public static integer
# getGMTDiff( )

Returns

integer
get local time zone offset from GMT
public static array
# getDate( integer|boolean $d = false, boolean $fast = false, boolean $gmt = false )

Returns the getdate() array.

Returns the getdate() array.

Parameters

$d
integer|boolean
$d original date timestamp. False to use the current timestamp.
$fast
boolean
$fast false to compute the day of the week, default is true
$gmt
boolean
$gmt true to calculate the GMT dates

Returns

array
an array with date info.
public static boolean
# isValidDate( integer $y, integer $m, integer $d )

Checks to see if the year, month, day are valid combination.

Checks to see if the year, month, day are valid combination.

Parameters

$y
integer
$y year
$m
integer
$m month
$d
integer
$d day

Returns

boolean
true if valid date, semantic check only.
public static boolean
# isValidTime( integer $h, integer $m, integer $s, boolean $hs24 = true )

Checks to see if the hour, minute and second are valid.

Checks to see if the hour, minute and second are valid.

Parameters

$h
integer
$h hour
$m
integer
$m minute
$s
integer
$s second
$hs24
boolean
$hs24 whether the hours should be 0 through 23 (default) or 1 through 12.

Returns

boolean
true if valid date, semantic check only.
public static string
# formatDate( string $fmt, integer|boolean $d = false, boolean $is_gmt = false )

Formats a timestamp to a date string.

Formats a timestamp to a date string.

Parameters

$fmt
string
$fmt format pattern
$d
integer|boolean
$d timestamp
$is_gmt
boolean
$is_gmt whether this is a GMT timestamp

Returns

string
formatted date based on timestamp $d
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.

Generates a timestamp. This is the same as the PHP function mktime http://php.net/manual/en/function.mktime.php.

Parameters

$hr
integer
$hr hour
$min
integer
$min minute
$sec
integer
$sec second
$mon
integer|boolean
$mon month
$day
integer|boolean
$day day
$year
integer|boolean
$year year
$is_gmt
boolean
$is_gmt whether this is GMT time. If true, gmmktime() will be used.

Returns

integer|float
a timestamp given a local time.
API documentation generated by ApiGen 2.8.0