Timestamp
extends Type
in package
implements
TypeInterface
The Timestamp complex data type.
Tags
Table of Contents
Interfaces
- TypeInterface
- The interface for all complex data types.
Properties
- $helper : string
- The error message returned for invalid values.
- $day : string
- The day part.
- $hour : string
- The hour part.
- $minute : string
- The minute part.
- $month : string
- The month part.
- $second : string
- The second part.
- $validationRule : string
- The validation rule (reg-ex) applied to Date values.
- $weekday : string
- The textual version of the day, e.g. Monday.
- $year : string
- The year part.
Methods
- __construct() : mixed
- Constructor.
- __toString() : string
- Used to convert the object to a printable string.
- getDate() : string
- Getter for the date part.
- getDay() : string
- Getter for the day part.
- getEuroValue() : string
- Get the date value as a string in the format "DD/MM/YYYY".
- getHelper() : string
- Get the validation helper text.
- getHour() : string
- Getter for the hour part.
- getMinute() : string
- Getter for the minute part.
- getMonth() : string
- Getter for the month part.
- getRule() : string
- Get the validation rule.
- getSecond() : string
- Getter for the second part.
- getTime() : string
- Getter for the time part.
- getTimeAway() : string
- Returns the difference between now and this timestamp value, in a human-readable format, e.g: 3 days ago, 3 days from now.
- getUnixValue() : int
- Return the value in UNIX timestamp format.
- getValue() : string
- Getter for the Timestamp value.
- getWeekday() : string
- Get the textual weekday part, e.g. Monday.
- getYear() : string
- Getter for the year part.
- populateFromString() : void
- Accepts a full date/time string in YYYY-mm-dd hh:ii:ss format.
- setDate() : void
- Setter for the date part.
- setHelper() : void
- Set the validation helper text.
- setRule() : void
- Set the validation rule.
- setTime() : void
- Setter for the time part.
- setTimestampValue() : void
- Setter for the timestamp value.
- setValue() : void
- Accepts a full date/time string in YYYY-mm-dd hh:ii:ss format.
Properties
$helper
The error message returned for invalid values.
protected
string
$helper
= 'Not a valid timestamp value! A timestamp should be in the format YYYY-MM-DD HH:MM:SS.'
Tags
$day
The day part.
private
string
$day
Tags
$hour
The hour part.
private
string
$hour
Tags
$minute
The minute part.
private
string
$minute
Tags
$month
The month part.
private
string
$month
Tags
$second
The second part.
private
string
$second
Tags
$validationRule
The validation rule (reg-ex) applied to Date values.
private
string
$validationRule
Tags
$weekday
The textual version of the day, e.g. Monday.
private
string
$weekday
Tags
$year
The year part.
private
string
$year
Tags
Methods
__construct()
Constructor.
public
__construct([mixed $timestamp = '' ]) : mixed
Parameters
- $timestamp : mixed = ''
Tags
__toString()
Used to convert the object to a printable string.
public
__toString() : string
Tags
Return values
stringgetDate()
Getter for the date part.
public
getDate() : string
Tags
Return values
stringgetDay()
Getter for the day part.
public
getDay() : string
Tags
Return values
stringgetEuroValue()
Get the date value as a string in the format "DD/MM/YYYY".
public
getEuroValue() : string
Tags
Return values
stringgetHelper()
Get the validation helper text.
public
getHelper() : string
Tags
Return values
stringgetHour()
Getter for the hour part.
public
getHour() : string
Tags
Return values
stringgetMinute()
Getter for the minute part.
public
getMinute() : string
Tags
Return values
stringgetMonth()
Getter for the month part.
public
getMonth() : string
Tags
Return values
stringgetRule()
Get the validation rule.
public
getRule() : string
Tags
Return values
stringgetSecond()
Getter for the second part.
public
getSecond() : string
Tags
Return values
stringgetTime()
Getter for the time part.
public
getTime() : string
Tags
Return values
stringgetTimeAway()
Returns the difference between now and this timestamp value, in a human-readable format, e.g: 3 days ago, 3 days from now.
public
getTimeAway() : string
Tags
Return values
stringgetUnixValue()
Return the value in UNIX timestamp format.
public
getUnixValue() : int
Tags
Return values
intgetValue()
Getter for the Timestamp value.
public
getValue() : string
Tags
Return values
stringgetWeekday()
Get the textual weekday part, e.g. Monday.
public
getWeekday() : string
Tags
Return values
stringgetYear()
Getter for the year part.
public
getYear() : string
Tags
Return values
stringpopulateFromString()
Accepts a full date/time string in YYYY-mm-dd hh:ii:ss format.
public
populateFromString(string $dateTime) : void
Parameters
- $dateTime : string
Tags
setDate()
Setter for the date part.
public
setDate(int $year, int $month, int $day) : void
Parameters
- $year : int
- $month : int
- $day : int
Tags
setHelper()
Set the validation helper text.
public
setHelper(string $helper) : void
Parameters
- $helper : string
Tags
setRule()
Set the validation rule.
public
setRule(string $rule) : void
Parameters
- $rule : string
Tags
setTime()
Setter for the time part.
public
setTime(int $hour, int $minute, int $second) : void
Parameters
- $hour : int
- $minute : int
- $second : int
Tags
setTimestampValue()
Setter for the timestamp value.
public
setTimestampValue(int $year, int $month, int $day, int $hour, int $minute, int $second) : void
Parameters
- $year : int
- $month : int
- $day : int
- $hour : int
- $minute : int
- $second : int
Tags
setValue()
Accepts a full date/time string in YYYY-mm-dd hh:ii:ss format.
public
setValue(mixed $dateTime) : void
Parameters
- $dateTime : mixed