TITAN Library for PHP5  5.1.0
Web Software Development Kit for PHP5
timestamp Class Reference

Titan Timestamp Class. More...

Public Member Functions

 __construct ($timestamp= '')
 
 set_stamp ($timestamp= '')
 
 stamp ()
 
 stamp2unix ($timestamp= '')
 
 unix2stamp ($time= '')
 
 to_string ($timestamp= '', $format= 'r')
 
 date_math ($expression= '', $timestamp= '')
 
 time_to_decimal ($time)
 
 decimal_to_time ($dec)
 

Data Fields

 $time_stamp
 set time in timestamp format (YmdHis)
 
 $time_unix
 set time in unix time format
 

Detailed Description

Titan Timestamp Class.

Class: \tl\data\timestamp

Author
James E. Bush work@.nosp@m.bush.nosp@m..cc
Version
5.1.0

Constructor & Destructor Documentation

__construct (   $timestamp = '')

Constructor

Parameters
string$timestamp(optional) Timestamp to use (in 'YmdHis' format ONLY!) If empty, use current unix time.

Member Function Documentation

set_stamp (   $timestamp = '')

Set the timestamp

Parameters
string$timestamp(optional) Timestamp to use (in 'YmdHis' format ONLY!) If empty, use the object's current unix time.
stamp ( )

Return the current timestamp

Returns
string the current timestamp
stamp2unix (   $timestamp = '')

Convert a timestamp to unix time

Parameters
string$timestamp(optional) Timestamp to use (in 'YmdHis' format ONLY!) If empty, use the object's saved timestamp.
Returns
int Timestamp in unix time
unix2stamp (   $time = '')

Convert unix time to a timestamp

Parameters
int$time(optional) Unix time to use (as from the time() function) If empty, use the object's saved unix time.
Returns
string unix time as a timestamp
to_string (   $timestamp = '',
  $format = 'r' 
)

Convert a timestamp into a formatted string

Parameters
string$timestamp(optional) The base timestamp to use If empty, uses the object's saved timestamp.
string$format(optional) The date format to use If empty, uses the format 'r' (RFC 2822 - Internet Message Format).
Returns
string String representation of the timestamp
date_math (   $expression = '',
  $timestamp = '' 
)

Calculate date/times relative to the timestamp

Parameters
string$expressionMay be an english phrase representing the time differences supported by strtotime(). e.g. '+1 hour', '-2 days', etc.
string$timestamp(optional) The base timestamp to use If empty, uses the object's saved timestamp.
Returns
string Updated timestamp after the expression has been applied
time_to_decimal (   $time)

Convert time into decimal time.

Parameters
string$timeThe time to convert
Returns
integer The time as a decimal value.
decimal_to_time (   $dec)

Convert decimal time into time in the format hh:mm:ss

Parameters
integer$decThe time as a decimal value.
Returns
string The converted time value.

The documentation for this class was generated from the following file: