Alpha Framework 3.1.0 API Documentation

Timestamp extends Type implements TypeInterface

The Timestamp complex data type.

Tags
since
1.0
author

John Collins dev@alphaframework.org

license

http://www.opensource.org/licenses/bsd-license.php The BSD License

copyright

Copyright (c) 2019, John Collins (founder of Alpha Framework). All rights reserved.

Redistribution and use in source and binary forms, with or
without modification, are permitted provided that the
following conditions are met:

* Redistributions of source code must retain the above
  copyright notice, this list of conditions and the
  following disclaimer.
* Redistributions in binary form must reproduce the above
  copyright notice, this list of conditions and the
  following disclaimer in the documentation and/or other
  materials provided with the distribution.
* Neither the name of the Alpha Framework nor the names
  of its contributors may be used to endorse or promote
  products derived from this software without specific
  prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Interfaces, Classes and Traits

TypeInterface
The interface for all complex data types.

Table of Contents

$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.
__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()  : mixed
Accepts a full date/time string in YYYY-mm-dd hh:ii:ss format.
setDate()  : mixed
Setter for the date part.
setHelper()  : mixed
Set the validation helper text.
setRule()  : mixed
Set the validation rule.
setTime()  : mixed
Setter for the time part.
setTimestampValue()  : mixed
Setter for the timestamp value.
setValue()  : mixed
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
since
1.0

$day

The day part.

private string $day
Tags
since
1.0

$hour

The hour part.

private string $hour
Tags
since
1.0

$minute

The minute part.

private string $minute
Tags
since
1.0

$month

The month part.

private string $month
Tags
since
1.0

$second

The second part.

private string $second
Tags
since
1.0

$validationRule

The validation rule (reg-ex) applied to Date values.

private string $validationRule
Tags
since
1.0

$weekday

The textual version of the day, e.g. Monday.

private string $weekday
Tags
since
1.0

$year

The year part.

private string $year
Tags
since
1.0

Methods

__construct()

Constructor.

public __construct([mixed $timestamp = '' ]) : mixed
Parameters
$timestamp : mixed = ''
Tags
since
1.0
throws
IllegalArguementException
Return values
mixed

__toString()

Used to convert the object to a printable string.

public __toString() : string
Tags
since
1.0
Return values
string

getDate()

Getter for the date part.

public getDate() : string
Tags
since
1.0
Return values
string

getDay()

Getter for the day part.

public getDay() : string
Tags
since
1.0
Return values
string

getEuroValue()

Get the date value as a string in the format "DD/MM/YYYY".

public getEuroValue() : string
Tags
since
1.0
Return values
string

getHelper()

Get the validation helper text.

public getHelper() : string
Tags
since
1.0
Return values
string

getHour()

Getter for the hour part.

public getHour() : string
Tags
since
1.0
Return values
string

getMinute()

Getter for the minute part.

public getMinute() : string
Tags
since
1.0
Return values
string

getMonth()

Getter for the month part.

public getMonth() : string
Tags
since
1.0
Return values
string

getRule()

Get the validation rule.

public getRule() : string
Tags
since
1.0
Return values
string

getSecond()

Getter for the second part.

public getSecond() : string
Tags
since
1.0
Return values
string

getTime()

Getter for the time part.

public getTime() : string
Tags
since
1.0
Return values
string

getTimeAway()

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
since
1.2.4
Return values
string

getUnixValue()

Return the value in UNIX timestamp format.

public getUnixValue() : int
Tags
since
1.0
Return values
int

getValue()

Getter for the Timestamp value.

public getValue() : string
Tags
since
1.0
Return values
string

getWeekday()

Get the textual weekday part, e.g. Monday.

public getWeekday() : string
Tags
since
1.0
Return values
string

getYear()

Getter for the year part.

public getYear() : string
Tags
since
1.0
Return values
string

populateFromString()

Accepts a full date/time string in YYYY-mm-dd hh:ii:ss format.

public populateFromString(string $dateTime) : mixed
Parameters
$dateTime : string
Tags
since
1.0
throws
IllegalArguementException
Return values
mixed

setDate()

Setter for the date part.

public setDate(int $year, int $month, int $day) : mixed
Parameters
$year : int
$month : int
$day : int
Tags
since
1.0
throws
IllegalArguementException
Return values
mixed

setHelper()

Set the validation helper text.

public setHelper(string $helper) : mixed
Parameters
$helper : string
Tags
since
1.0
Return values
mixed

setRule()

Set the validation rule.

public setRule(string $rule) : mixed
Parameters
$rule : string
Tags
since
1.0
Return values
mixed

setTime()

Setter for the time part.

public setTime(int $hour, int $minute, int $second) : mixed
Parameters
$hour : int
$minute : int
$second : int
Tags
since
1.0
throws
IllegalArguementException
Return values
mixed

setTimestampValue()

Setter for the timestamp value.

public setTimestampValue(int $year, int $month, int $day, int $hour, int $minute, int $second) : mixed
Parameters
$year : int
$month : int
$day : int
$hour : int
$minute : int
$second : int
Tags
since
1.0
throws
IllegalArguementException
Return values
mixed

setValue()

Accepts a full date/time string in YYYY-mm-dd hh:ii:ss format.

public setValue(string $dateTime) : mixed
Parameters
$dateTime : string
Tags
since
1.0
Return values
mixed

Search results