Arikaim CMS

DateTime
in package

DateTime

Table of Contents

Constants

DEFAULT_DATE_FORMAT  = 'Y-m-d'
DEFAULT_TIME_FORMAT  = 'H:i'
ICALENDAR_EVENT  = 'Ymd\\THis'
ICALENDAR_EVENT_UTC  = 'Ymd\\THis\\Z'
ISO8601_FORMAT  = DATE_ATOM
ISO8601ZULU_FORMAT  = 'Y-m-d\\TH:i:s\\Z'
RFC3339_FORMAT  = DATE_RFC3339

Properties

$dateFormat  : string|null
Date format
$dateTime  : DateTime
DateTime object
$timeFormat  : string|null
Time formats list
$timeZone  : object
Time zone

Methods

addInterval()  : DateTime
Add interval
convert()  : string|false
Convert date string to other format
create()  : DateTime
Create DateTime obj
createFromTimestamp()  : object
Create form timestamp
dateFormat()  : string|null
Return formated date
dateTimeFormat()  : string|null
Return formated timestsamp with current date and time format
getCurrentTimestamp()  : int
Get current timestamp
getCurrentYear()  : string
Get current year
getDateFormat()  : string
Get date format
getDateTime()  : DateTime
Get DateTime
getDay()  : string
Return current day
getHour()  : string
Return current hour
getInterval()  : array<string|int, mixed>
Get interval details
getLastDay()  : int
Get last day of month
getLocation()  : mixed
Get location
getMinutes()  : string
Get current minutes
getMonth()  : string
Get current month
getTimeFormat()  : string
Get time format
getTimestamp()  : int
Get timestamp
getTimeZone()  : DateTimeZone|null
Get time zone
getTimeZoneName()  : string
Get time zone
getTimeZoneOffset()  : string
Get time zone offset
getTimeZonesList()  : array<string|int, mixed>|false
Get time zone list
getYear()  : string
Get curent year
isValidTimeZone()  : bool
Return true if time zone is vlaid
modify()  : DateTime
Modify date time
setDateFormat()  : void
Set date format
setDateTime()  : void
Set date time obj
setTimeFormat()  : void
Set time formats
setTimestamp()  : DateTime
Set timestamp
setTimeZone()  : void
Set time zone
subInterval()  : DateTime
Sub interval
timeFormat()  : string|null
Return formated time
today()  : DateTime
Get current date
toString()  : string
Convert current date time to string.
toTimestamp()  : int
Comvert date time to timestamp

Constants

DEFAULT_DATE_FORMAT

public mixed DEFAULT_DATE_FORMAT = 'Y-m-d'

DEFAULT_TIME_FORMAT

public mixed DEFAULT_TIME_FORMAT = 'H:i'

ICALENDAR_EVENT

public mixed ICALENDAR_EVENT = 'Ymd\\THis'

ICALENDAR_EVENT_UTC

public mixed ICALENDAR_EVENT_UTC = 'Ymd\\THis\\Z'

ISO8601_FORMAT

public mixed ISO8601_FORMAT = DATE_ATOM

ISO8601ZULU_FORMAT

public mixed ISO8601ZULU_FORMAT = 'Y-m-d\\TH:i:s\\Z'

RFC3339_FORMAT

public mixed RFC3339_FORMAT = DATE_RFC3339

Properties

$dateFormat

Date format

private static string|null $dateFormat = null

$dateTime

DateTime object

private static DateTime $dateTime

$timeFormat

Time formats list

private static string|null $timeFormat = null

$timeZone

Time zone

private static object $timeZone

Methods

addInterval()

Add interval

public static addInterval(string $dateInterval) : DateTime
Parameters
$dateInterval : string
Return values
DateTime

convert()

Convert date string to other format

public static convert(string $date[, string|null $format = null ]) : string|false
Parameters
$date : string
$format : string|null = null
Return values
string|false

create()

Create DateTime obj

public static create([string|null $date = null ][, string|null $format = null ]) : DateTime
Parameters
$date : string|null = null
$format : string|null = null
Return values
DateTime

createFromTimestamp()

Create form timestamp

public static createFromTimestamp(int $timestamp[, string|null $format = null ]) : object
Parameters
$timestamp : int
$format : string|null = null
Return values
object

dateFormat()

Return formated date

public static dateFormat(int|null $timestamp[, string|null $format = null ]) : string|null
Parameters
$timestamp : int|null
$format : string|null = null
Return values
string|null

dateTimeFormat()

Return formated timestsamp with current date and time format

public static dateTimeFormat(int|null $timestamp[, string|null $format = null ]) : string|null
Parameters
$timestamp : int|null
$format : string|null = null
Return values
string|null

getCurrentTimestamp()

Get current timestamp

public static getCurrentTimestamp() : int
Return values
int

getCurrentYear()

Get current year

public static getCurrentYear() : string
Return values
string

getDateFormat()

Get date format

public static getDateFormat() : string
Return values
string

getDateTime()

Get DateTime

public static getDateTime() : DateTime
Return values
DateTime

getDay()

Return current day

public static getDay() : string
Return values
string

getHour()

Return current hour

public static getHour() : string
Return values
string

getInterval()

Get interval details

public static getInterval(string $intervalText) : array<string|int, mixed>
Parameters
$intervalText : string
Return values
array<string|int, mixed>

getLastDay()

Get last day of month

public static getLastDay(int|string $month) : int
Parameters
$month : int|string
Return values
int

getLocation()

Get location

public static getLocation() : mixed

getMinutes()

Get current minutes

public static getMinutes() : string
Return values
string

getMonth()

Get current month

public static getMonth() : string
Return values
string

getTimeFormat()

Get time format

public static getTimeFormat() : string
Return values
string

getTimestamp()

Get timestamp

public static getTimestamp() : int
Return values
int

getTimeZone()

Get time zone

public static getTimeZone() : DateTimeZone|null
Return values
DateTimeZone|null

getTimeZoneName()

Get time zone

public static getTimeZoneName() : string
Return values
string

getTimeZoneOffset()

Get time zone offset

public static getTimeZoneOffset([DateTime|null $dateTime = null ]) : string
Parameters
$dateTime : DateTime|null = null
Return values
string

getTimeZonesList()

Get time zone list

public static getTimeZonesList() : array<string|int, mixed>|false
Return values
array<string|int, mixed>|false

getYear()

Get curent year

public static getYear() : string
Return values
string

isValidTimeZone()

Return true if time zone is vlaid

public static isValidTimeZone(string|null $name) : bool
Parameters
$name : string|null
Return values
bool

modify()

Modify date time

public static modify(string|null $dateText) : DateTime
Parameters
$dateText : string|null
Return values
DateTime

setDateFormat()

Set date format

public static setDateFormat([string|null $format = null ]) : void
Parameters
$format : string|null = null

setDateTime()

Set date time obj

public static setDateTime([string|null $date = null ][, string|null $format = null ]) : void
Parameters
$date : string|null = null
$format : string|null = null

setTimeFormat()

Set time formats

public static setTimeFormat([string|null $format = null ]) : void
Parameters
$format : string|null = null

setTimestamp()

Set timestamp

public static setTimestamp(int $unixTimestamp) : DateTime
Parameters
$unixTimestamp : int
Return values
DateTime

setTimeZone()

Set time zone

public static setTimeZone(string|null $name) : void
Parameters
$name : string|null

subInterval()

Sub interval

public static subInterval(string $dateInterval) : DateTime
Parameters
$dateInterval : string
Return values
DateTime

timeFormat()

Return formated time

public static timeFormat(int|null $timestamp[, string $format = null ]) : string|null
Parameters
$timestamp : int|null
$format : string = null
Return values
string|null

today()

Get current date

public static today([string|null $format = null ]) : DateTime
Parameters
$format : string|null = null
Return values
DateTime

toString()

Convert current date time to string.

public static toString([string|null $format = null ]) : string
Parameters
$format : string|null = null
Return values
string

toTimestamp()

Comvert date time to timestamp

public static toTimestamp([string|null $date = null ][, string|null $format = null ]) : int
Parameters
$date : string|null = null
$format : string|null = null
Return values
int

        
On this page

Search results