
Represents a time of day as a value object
1.0.0b12 | Fixed a method signature 8/24/11 |
---|---|
1.0.0b11 | Fixed a bug with the constructor not properly handling unix timestamps that are negative integers 6/2/11 |
1.0.0b10 | Changed the $time attribute to be protected 3/20/11 |
1.0.0b9 | Added the $simple parameter to getFuzzyDifference() 3/15/10 |
1.0.0b8 | Added a call to fTimestamp::callUnformatCallback() in __construct() for localization support 6/1/09 |
1.0.0b7 | Backwards compatibility break - Removed getSecondsDifference(), added eq(), gt(), gte(), lt(), lte() 3/5/09 |
1.0.0b6 | Fixed an outdated fCore method call 2/23/09 |
1.0.0b5 | Updated for new fCore API 2/16/09 |
1.0.0b4 | Fixed __construct() to properly handle the 5.0 to 5.1 change in strtotime() 1/21/09 |
1.0.0b3 | Added support for CURRENT_TIMESTAMP and CURRENT_TIME SQL keywords 1/11/09 |
1.0.0b2 | Removed the adjustment amount check from adjust() 12/31/08 |
1.0.0b | The initial implementation 2/12/08 |
A timestamp of the time
integer
Composes text using fText if loaded
string compose( string $message, mixed $component [, ... ] )
string | $message | The message to compose |
mixed | $component [, ... ] | A string or number to insert into the message |
The composed and possible translated message
Creates the time to represent, no timezone is allowed since times don't have timezones
fTime __construct( fTime|object|string|integer $time=NULL )
fTime|object|string|integer | $time | The time to represent, NULL is interpreted as now |
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
All requests that hit this method should be requests for callbacks
callback __get( string $method )
string | $method | The method to create a callback for |
The callback for the method requested
Returns this time in 'H:i:s' format
string __toString( )
The 'H:i:s' format of this time
Changes the time by the adjustment specified, only adjustments of 'hours', 'minutes', and 'seconds' are allowed
fTime adjust( string $adjustment )
string | $adjustment | The adjustment to make |
The adjusted time
If this time is equal to the time passed
boolean eq( fTime|object|string|integer $other_time=NULL )
fTime|object|string|integer | $other_time | The time to compare with, NULL is interpreted as today |
If this time is equal to the one passed
Formats the time
string format( string $format )
string | $format | The date() function compatible formatting string, or a format name from fTimestamp::defineFormat() |
The formatted time
Returns the approximate difference in time, discarding any unit of measure but the least specific.
The output will read like:
Examples of output for a time passed might be:
Examples of output for no time passed might be:
You would never get the following output since it includes more than one unit of time measurement:
Values that are close to the next largest unit of measure will be rounded up:
string getFuzzyDifference( fTime|object|string|integer $other_time=NULL, boolean $simple=FALSE )
string getFuzzyDifference( boolean $simple=FALSE )
fTime|object|string|integer | $other_time | The time to create the difference with, NULL is interpreted as now |
boolean | $simple | When TRUE, the returned value will only include the difference in the two times, but not from now, ago, after or before |
The fuzzy difference in time between the this time and the one provided
If this time is greater than the time passed
boolean gt( fTime|object|string|integer $other_time=NULL )
fTime|object|string|integer | $other_time | The time to compare with, NULL is interpreted as now |
If this time is greater than the one passed
If this time is greater than or equal to the time passed
boolean gte( fTime|object|string|integer $other_time=NULL )
fTime|object|string|integer | $other_time | The time to compare with, NULL is interpreted as now |
If this time is greater than or equal to the one passed
If this time is less than the time passed
boolean lt( fTime|object|string|integer $other_time=NULL )
fTime|object|string|integer | $other_time | The time to compare with, NULL is interpreted as today |
If this time is less than the one passed
If this time is less than or equal to the time passed
boolean lte( fTime|object|string|integer $other_time=NULL )
fTime|object|string|integer | $other_time | The time to compare with, NULL is interpreted as today |
If this time is less than or equal to the one passed
Modifies the current time, creating a new fTime object
The purpose of this method is to allow for easy creation of a time based on this time. Below are some examples of formats to modify the current time:
fTime modify( string $format )
string | $format | The current time will be formatted with this string, and the output used to create a new object |
The new time