Class TimeHelper
Time Helper class for easy use of time data.
Manipulation of time data.
- AppHelper
 - 
			
TimeHelper			
			
			
		 
Link: http://book.cakephp.org/2.0/en/core-libraries/helpers/time.html
See:
CakeTimeCopyright: Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
License: MIT License
Location: Cake/View/Helper/TimeHelper.php
Properties summary
- 
			
$_engineprotectedstdClassCakeTime instance 
Method Summary
- 
			
__call() public
Call methods from CakeTime utility class - 
			
__construct() public
Constructor - 
			
__get() public
Magic accessor for attributes that were deprecated. - 
			
__isset() public
Magic isset check for deprecated attributes. - 
			
__set() public
Magic accessor for deprecated attributes. - 
			
convert() public
 - 
			
convertSpecifiers() public
 - 
			
dayAsSql() public
 - 
			
daysAsSql() public
 - 
			
format() public
 - 
			
fromString() public
 - 
			
gmt() public
 - 
			
i18nFormat() public
 - 
			
isThisMonth() public
 - 
			
isThisWeek() public
 - 
			
isThisYear() public
 - 
			
isToday() public
 - 
			
isTomorrow() public
 - 
			
isWithinNext() public
 - 
			
nice() public
 - 
			
niceShort() public
 - 
			
serverOffset() public
 - 
			
timeAgoInWords() public
 - 
			
toAtom() public
 - 
			
toQuarter() public
 - 
			
toRSS() public
 - 
			
toUnix() public
 - 
			
wasWithinLast() public
 - 
			
wasYesterday() public
 
Method Detail
__construct() public ¶
__construct( View $View , array $settings = array() )
		
Constructor
Settings:
engineClass name to use to replace CakeTime functionality The class needs to be placed in theUtilitydirectory.
Parameters
- 
						
View$View - the view object the helper is attached to.
 - array $settings optional array()
 - Settings array
 
Throws
__get() public ¶
__get( string $name )
Magic accessor for attributes that were deprecated.
Parameters
- string $name
 - Name of the attribute to get.
 
Returns
__isset() public ¶
__isset( string $name )
Magic isset check for deprecated attributes.
Parameters
- string $name
 - Name of the attribute to check.
 
Returns
__set() public ¶
__set( string $name , string $value )
Magic accessor for deprecated attributes.
Parameters
- string $name
 - Name of the attribute to set.
 - string $value
 - Value of the attribute to set.
 
convert() public ¶
convert( string $serverTime , string|DateTimeZone $timezone )
Parameters
- string $serverTime
 - UNIX timestamp
 - string|DateTimeZone $timezone
 - User's timezone string or DateTimeZone object
 
Returns
UNIX timestamp
See
Link
convertSpecifiers() public ¶
convertSpecifiers( string $format , string $time = null )
Parameters
- string $format
 Format with specifiers for strftime function. Accepts the special specifier %S which mimics the modifier S for date()
- string $time optional null
 - UNIX timestamp
 
Returns
windows safe and date() function compatible format for strftime
See
Link
dayAsSql() public ¶
dayAsSql( integer|string|DateTime $dateString , string $fieldName , string|DateTimeZone $timezone = null )
Parameters
- integer|string|DateTime $dateString
 - UNIX timestamp, strtotime() valid string or DateTime object
 - string $fieldName
 - Name of database field to compare with
 - string|DateTimeZone $timezone optional null
 - User's timezone string or DateTimeZone object
 
Returns
Partial SQL string.
See
Link
daysAsSql() public ¶
daysAsSql( integer|string|DateTime $begin , integer|string|DateTime $end , string $fieldName , string|DateTimeZone $timezone = null )
Parameters
- integer|string|DateTime $begin
 - UNIX timestamp, strtotime() valid string or DateTime object
 - integer|string|DateTime $end
 - UNIX timestamp, strtotime() valid string or DateTime object
 - string $fieldName
 - Name of database field to compare with
 - string|DateTimeZone $timezone optional null
 - User's timezone string or DateTimeZone object
 
Returns
Partial SQL string.
See
Link
format() public ¶
format( integer|string|DateTime $format , integer|string|DateTime $date = null , boolean $invalid = false , string|DateTimeZone $timezone = null )
Parameters
- integer|string|DateTime $format
 - date format string (or a UNIX timestamp, strtotime() valid string or DateTime object)
 - integer|string|DateTime $date optional null
 - UNIX timestamp, strtotime() valid string or DateTime object (or a date format string)
 - boolean $invalid optional false
 - flag to ignore results of fromString == false
 - string|DateTimeZone $timezone optional null
 - User's timezone string or DateTimeZone object
 
Returns
Formatted date string
See
Link
fromString() public ¶
fromString( integer|string|DateTime $dateString , string|DateTimeZone $timezone = null )
Parameters
- integer|string|DateTime $dateString
 - UNIX timestamp, strtotime() valid string or DateTime object
 - string|DateTimeZone $timezone optional null
 - User's timezone string or DateTimeZone object
 
Returns
Parsed timestamp
See
Link
gmt() public ¶
gmt( integer|string|DateTime $string = null )
Parameters
- integer|string|DateTime $string optional null
 - UNIX timestamp, strtotime() valid string or DateTime object
 
Returns
UNIX timestamp
See
Link
i18nFormat() public ¶
i18nFormat( integer|string|DateTime $date , string $format = null , boolean $invalid = false , string|DateTimeZone $timezone = null )
Parameters
- integer|string|DateTime $date
 - UNIX timestamp, strtotime() valid string or DateTime object
 - string $format optional null
 - strftime format string.
 - boolean $invalid optional false
 - flag to ignore results of fromString == false
 - string|DateTimeZone $timezone optional null
 - User's timezone string or DateTimeZone object
 
Returns
Formatted and translated date string
See
Link
isThisMonth() public ¶
isThisMonth( integer|string|DateTime $dateString , string|DateTimeZone $timezone = null )
Parameters
- integer|string|DateTime $dateString
 - UNIX timestamp, strtotime() valid string or DateTime object
 - string|DateTimeZone $timezone optional null
 - User's timezone string or DateTimeZone object
 
Returns
True if datetime string is within current month
See
Link
isThisWeek() public ¶
isThisWeek( integer|string|DateTime $dateString , string|DateTimeZone $timezone = null )
Parameters
- integer|string|DateTime $dateString
 - UNIX timestamp, strtotime() valid string or DateTime object
 - string|DateTimeZone $timezone optional null
 - User's timezone string or DateTimeZone object
 
Returns
True if datetime string is within current week
See
Link
isThisYear() public ¶
isThisYear( integer|string|DateTime $dateString , string|DateTimeZone $timezone = null )
Parameters
- integer|string|DateTime $dateString
 - UNIX timestamp, strtotime() valid string or DateTime object
 - string|DateTimeZone $timezone optional null
 - User's timezone string or DateTimeZone object
 
Returns
True if datetime string is within current year
See
Link
isToday() public ¶
isToday( integer|string|DateTime $dateString , string|DateTimeZone $timezone = null )
Parameters
- integer|string|DateTime $dateString
 - UNIX timestamp, strtotime() valid string or DateTime object
 - string|DateTimeZone $timezone optional null
 - User's timezone string or DateTimeZone object
 
Returns
True if datetime string is today
See
Link
isTomorrow() public ¶
isTomorrow( integer|string|DateTime $dateString , string|DateTimeZone $timezone = null )
Parameters
- integer|string|DateTime $dateString
 - UNIX timestamp, strtotime() valid string or DateTime object
 - string|DateTimeZone $timezone optional null
 - User's timezone string or DateTimeZone object
 
Returns
True if datetime string was yesterday
See
Link
isWithinNext() public ¶
isWithinNext( string|integer $timeInterval , integer|string|DateTime $dateString , string|DateTimeZone $timezone = null )
Parameters
- string|integer $timeInterval
 the numeric value with space then time type. Example of valid types: 6 hours, 2 days, 1 minute.
- integer|string|DateTime $dateString
 - UNIX timestamp, strtotime() valid string or DateTime object
 - string|DateTimeZone $timezone optional null
 - User's timezone string or DateTimeZone object
 
Returns
See
Link
nice() public ¶
nice( integer|string|DateTime $dateString = null , string|DateTimeZone $timezone = null , string $format = null )
Parameters
- integer|string|DateTime $dateString optional null
 - UNIX timestamp, strtotime() valid string or DateTime object
 - string|DateTimeZone $timezone optional null
 - User's timezone string or DateTimeZone object
 - string $format optional null
 - The format to use. If null, 
TimeHelper::$niceFormatis used 
Returns
Formatted date string
See
Link
niceShort() public ¶
niceShort( integer|string|DateTime $dateString = null , string|DateTimeZone $timezone = null )
Parameters
- integer|string|DateTime $dateString optional null
 - UNIX timestamp, strtotime() valid string or DateTime objectp
 - string|DateTimeZone $timezone optional null
 - User's timezone string or DateTimeZone object
 
Returns
Described, relative date string
See
Link
timeAgoInWords() public ¶
timeAgoInWords( integer|string|DateTime $dateTime , array $options = array() )
Parameters
- integer|string|DateTime $dateTime
 - UNIX timestamp, strtotime() valid string or DateTime object
 - array $options optional array()
 - Default format if timestamp is used in $dateString
 
Returns
Relative time string.
See
CakeTime::timeAgoInWords()
Addition options
element- The element to wrap the formatted time in. Has a few additional options:tag- The tag to use
defaults to 'span'.
  - class - The classname to use
defaults to time-ago-in-words.
  - title - Defaults to the $dateTime input.
Link
toAtom() public ¶
toAtom( integer|string|DateTime $dateString , string|DateTimeZone $timezone = null )
Parameters
- integer|string|DateTime $dateString
 - UNIX timestamp, strtotime() valid string or DateTime object
 - string|DateTimeZone $timezone optional null
 - User's timezone string or DateTimeZone object
 
Returns
Formatted date string
See
Link
toQuarter() public ¶
toQuarter( integer|string|DateTime $dateString , boolean $range = false )
Parameters
- integer|string|DateTime $dateString
 - UNIX timestamp, strtotime() valid string or DateTime object
 - boolean $range optional false
 - if true returns a range in Y-m-d format
 
Returns
1, 2, 3, or 4 quarter of year or array if $range true
See
Link
toRSS() public ¶
toRSS( integer|string|DateTime $dateString , string|DateTimeZone $timezone = null )
Parameters
- integer|string|DateTime $dateString
 - UNIX timestamp, strtotime() valid string or DateTime object
 - string|DateTimeZone $timezone optional null
 - User's timezone string or DateTimeZone object
 
Returns
Formatted date string
See
Link
toUnix() public ¶
toUnix( integer|string|DateTime $dateString , string|DateTimeZone $timezone = null )
Parameters
- integer|string|DateTime $dateString
 - UNIX timestamp, strtotime() valid string or DateTime object
 - string|DateTimeZone $timezone optional null
 - User's timezone string or DateTimeZone object
 
Returns
Unix timestamp
See
Link
wasWithinLast() public ¶
wasWithinLast( string|integer $timeInterval , integer|string|DateTime $dateString , string|DateTimeZone $timezone = null )
Parameters
- string|integer $timeInterval
 the numeric value with space then time type. Example of valid types: 6 hours, 2 days, 1 minute.
- integer|string|DateTime $dateString
 - UNIX timestamp, strtotime() valid string or DateTime object
 - string|DateTimeZone $timezone optional null
 - User's timezone string or DateTimeZone object
 
Returns
See
Link
wasYesterday() public ¶
wasYesterday( integer|string|DateTime $dateString , string|DateTimeZone $timezone = null )
Parameters
- integer|string|DateTime $dateString
 - UNIX timestamp, strtotime() valid string or DateTime object
 - string|DateTimeZone $timezone optional null
 - User's timezone string or DateTimeZone object
 
Returns
True if datetime string was yesterday