DateTimeFormatTrait
+ Inheritance diagram for DateTimeFormatTrait:

Description

Date-time formatting.

Public Methods

DateTime date ()
 YYYY-MM-DD More...
 
Str dateFormat ($format)
 Date formatting expression using a driver-appropriate function. More...
 
DateTime datetime ()
 YYYY-MM-DD hh:mm:ss More...
 
Num day ()
 01 to 31 More...
 
Num dayOfWeek ()
 0 to 6 (Sunday is 0) More...
 
Num dayOfYear ()
 001 to 366 (365 + 1 during leap year) More...
 
Num hours ()
 00 to 23 More...
 
Str iso8601 ()
 ISO-8601 compatible datetime string, offset Z (UTC/Zulu) More...
 
Num julian ()
 Julian day number (fractional). More...
 
Num minutes ()
 00 to 59 More...
 
Num month ()
 01 to 12 More...
 
Num seconds ()
 00 to 59 More...
 
Str time ()
 00:00:00 to 23:59:59 More...
 
Num timestamp ()
 Unix timestamp. More...
 
Num weekOfYear ()
 00 to 53 More...
 
Num year ()
 YYYY More...
 

Methods

◆ date()

DateTime date ( )

YYYY-MM-DD

Because this format is reentrant, a DateTime is returned.

Returns
DateTime

◆ dateFormat()

Str dateFormat (   $format)

Date formatting expression using a driver-appropriate function.

Parameters
string | string[]$formatFormat, or formats keyed by driver name.
Returns
Str

◆ datetime()

DateTime datetime ( )

YYYY-MM-DD hh:mm:ss

Because this format is reentrant, a DateTime is returned.

Returns
DateTime

◆ day()

Num day ( )

01 to 31

Returns
Num

◆ dayOfWeek()

Num dayOfWeek ( )

0 to 6 (Sunday is 0)

Returns
Num

◆ dayOfYear()

Num dayOfYear ( )

001 to 366 (365 + 1 during leap year)

Returns
Num

◆ hours()

Num hours ( )

00 to 23

Returns
Num

◆ iso8601()

Str iso8601 ( )

ISO-8601 compatible datetime string, offset Z (UTC/Zulu)

https://en.wikipedia.org/wiki/ISO_8601

Returns
Str

◆ julian()

Num julian ( )

Julian day number (fractional).

Returns
Num

◆ minutes()

Num minutes ( )

00 to 59

Returns
Num

◆ month()

Num month ( )

01 to 12

Returns
Num

◆ seconds()

Num seconds ( )

00 to 59

Returns
Num

◆ time()

Str time ( )

00:00:00 to 23:59:59

Returns
Str

◆ timestamp()

Num timestamp ( )

Unix timestamp.

Returns
Num

◆ weekOfYear()

Num weekOfYear ( )

00 to 53

Returns
Num

◆ year()

Num year ( )

YYYY

Returns
Num