Date_Time
in package
Date and time formatting and handling.
Tags
Table of Contents
Properties
- $date_pattern : string
- Date format.
- $date_time_pattern : string
- Date and time format.
- $instances : array<string|int, object>
- The array of instances of this class and sub-classes.
- $time_pattern : string
- Time format.
Methods
- format_date() : string
- Format a date string and return date in site standard.
- get_instance() : object
- Creates and/or returns the instance of this class.
- stamp_to_date() : string
- Return formatted date from unix timestamp.
- stamp_to_date_time() : string
- Return formatted date and time from unix timestamp.
- __construct() : void
- Initialise the class.
Properties
$date_pattern
Date format.
protected
string
$date_pattern
= ''
Tags
$date_time_pattern
Date and time format.
protected
string
$date_time_pattern
= ''
Tags
$instances
The array of instances of this class and sub-classes.
protected
static array<string|int, object>
$instances
= array()
Tags
$time_pattern
Time format.
protected
string
$time_pattern
= ''
Tags
Methods
format_date()
Format a date string and return date in site standard.
public
format_date(string $date_val) : string
Parameters
- $date_val : string
-
The date string to format.
Tags
Return values
string —The formatted date, or empty string,
get_instance()
Creates and/or returns the instance of this class.
public
static get_instance() : object
Tags
Return values
object —The instance of this class.
stamp_to_date()
Return formatted date from unix timestamp.
public
stamp_to_date(int $timestamp) : string
Parameters
- $timestamp : int
-
unix timestamp.
Tags
Return values
string —Formatted date.
stamp_to_date_time()
Return formatted date and time from unix timestamp.
public
stamp_to_date_time(int $timestamp) : string
Parameters
- $timestamp : int
-
unix timestamp.
Tags
Return values
string —Formatted date.
__construct()
Initialise the class.
protected
__construct() : void