DateTime
+ Inheritance diagram for DateTime:

Description

A date-time expression.

Public Static Methods

static self now (DB $db)
 An expression for the current date and time. More...
 
static self today (DB $db)
 An expression for the current date. More...
 
static self tomorrow (DB $db)
 An expression for tomorrow's date. More...
 
static self yesterday (DB $db)
 An expression for yesterday's date. More...
 
- Public Static Methods inherited from Expression
magic static self factory (DB $db, string $expression)
 

Additional Inherited Members

- Protected Properties inherited from Expression
DB $db
 
string $expression
 
- Public Methods inherited from Expression
 __construct (DB $db, string $expression)
 
string __toString ()
 
- Public Methods inherited from DateTimeAddTrait
DateTime addDay ()
 
DateTime addDays (int $days)
 
DateTime addHour ()
 
DateTime addHours (int $hours)
 
DateTime addMinute ()
 
DateTime addMinutes (int $minutes)
 
DateTime addMonth ()
 
DateTime addMonths (int $months)
 
DateTime addSecond ()
 
DateTime addSeconds (int $seconds)
 
DateTime addYear ()
 
DateTime addYears (int $years)
 
- Public Methods inherited from DateTimeModifyTrait
DateTime firstDayOfMonth ()
 YYYY-MM-01 More...
 
DateTime firstDayOfYear ()
 YYYY-01-01 More...
 
DateTime lastDayOfMonth ()
 YYYY-MM-DD More...
 
DateTime lastDayOfYear ()
 YYYY-12-31 More...
 
DateTime modify ($s, int $m=0, int $h=0, int $D=0, int $M=0, int $Y=0)
 Applies date-time modifiers. More...
 
DateTime setDate (int $day=null, int $month=null, int $year=null)
 Manually set the date components, preserving the time. More...
 
DateTime setDay (int $day)
 
DateTime setHours (int $hours)
 
DateTime setMinutes (int $minutes)
 
DateTime setMonth (int $month)
 
DateTime setSeconds (int $seconds)
 
DateTime setTime (int $seconds=null, int $minutes=null, int $hours=null)
 Manually set the time components, preserving the date. More...
 
DateTime setYear (int $year)
 
DateTime toUTC (string $mysqlLocalTz=null)
 Changes the timezone from local to UTC. More...
 
- Public Methods inherited from DateTimeFormatTrait
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...
 
- Public Methods inherited from DateTimeDiffTrait
Num diffDays (DateTime $x=null)
 Date-time difference ($x - $this) in fractional days elapsed. More...
 
Num diffHours (DateTime $x=null)
 Date-time difference ($x - $this) in fractional hours elapsed. More...
 
Num diffMinutes (DateTime $x=null)
 Date-time difference ($x - $this) in fractional minutes elapsed. More...
 
Num diffMonths (DateTime $x=null)
 Date-time difference ($x - $this) in fractional months elapsed. More...
 
Num diffSeconds (DateTime $x=null)
 Date-time difference ($x - $this) in fractional seconds elapsed. More...
 
Num diffYears (DateTime $x=null)
 Date-time difference ($x - $this) in fractional years elapsed. More...
 
- Public Methods inherited from DateTimeSubTrait
DateTime subDay ()
 
DateTime subDays (int $days)
 
DateTime subHour ()
 
DateTime subHours (int $hours)
 
DateTime subMinute ()
 
DateTime subMinutes (int $minutes)
 
DateTime subMonth ()
 
DateTime subMonths (int $months)
 
DateTime subSecond ()
 
DateTime subSeconds (int $seconds)
 
DateTime subYear ()
 
DateTime subYears (int $years)
 
- Public Methods inherited from ValueTrait
Value coalesce (array $values)
 COALESCE($this, ...$values) More...
 
- Public Methods inherited from AggregateTrait
Num avg ()
 AVG($this) More...
 
Num avgDistinct ()
 AVG(DISTINCT $this) More...
 
Num count ()
 COUNT($this) More...
 
Num countDistinct ()
 COUNT(DISTINCT $this) More...
 
Str groupConcat (string $delimiter=',')
 GROUP_CONCAT($this) using a delimiter. More...
 
Num max ()
 MAX($this) More...
 
Num min ()
 MIN($this) More...
 
Num sum ()
 SUM($this) More...
 
Num sumDistinct ()
 SUM(DISTINCT $this) More...
 
- Public Methods inherited from ComparisonTrait
Predicate is ($arg)
 Null-safe type-strict equality. More...
 
Predicate isBetween ($min, $max)
 $this BETWEEN $min AND $max (inclusive) More...
 
Predicate isEqual ($arg)
 See Predicate::match(). More...
 
Predicate isFalse ()
 $this IS FALSE More...
 
Predicate isGt ($arg)
 $this > $arg, or driver-appropriate $this > ALL (SELECT ...) More...
 
Predicate isGtAny (Select $select)
 Driver-appropriate $this > ANY (SELECT ...) More...
 
Predicate isGte ($arg)
 $this >= $arg, or driver-appropriate $this >= ALL (SELECT ...) More...
 
Predicate isGteAny (Select $select)
 Driver-appropriate $this >= ANY (SELECT ...) More...
 
Predicate isLike (string $pattern)
 $this LIKE $pattern More...
 
Predicate isLt ($arg)
 $this < $arg, or driver-appropriate $this < ALL (SELECT ...) More...
 
Predicate isLtAny (Select $select)
 Driver-appropriate $this < ANY (SELECT ...) More...
 
Predicate isLte ($arg)
 $this <= $arg, or driver-appropriate $this <= ALL (SELECT ...) More...
 
Predicate isLteAny (Select $select)
 Driver-appropriate $this <= ANY (SELECT ...) More...
 
Predicate isNot ($arg)
 Null-safe type-strict inequality. More...
 
Predicate isNotBetween ($min, $max)
 $this NOT BETWEEN $min AND $max (inclusive) More...
 
Predicate isNotEqual ($arg)
 $this <> $arg or $this NOT IN ($arg) More...
 
Predicate isNotLike (string $pattern)
 $this NOT LIKE $pattern More...
 
Predicate isNotNull ()
 $this IS NOT NULL More...
 
Predicate isNotRegExp (string $pattern)
 $this NOT REGEXP $pattern More...
 
Predicate isNull ()
 $this IS NULL More...
 
Predicate isRegExp (string $pattern)
 $this REGEXP $pattern More...
 
Branch switch (array $values=[])
 CASE $this ... More...
 
- Public Methods inherited from StrCastTrait
Str toStr ()
 Casts the expression as a character string. More...
 

Methods

◆ now()

static self now ( DB  $db)
static

An expression for the current date and time.

Parameters
DB$db
Returns
self

◆ today()

static self today ( DB  $db)
static

An expression for the current date.

Parameters
DB$db
Returns
self

◆ tomorrow()

static self tomorrow ( DB  $db)
static

An expression for tomorrow's date.

Parameters
DB$db
Returns
self

◆ yesterday()

static self yesterday ( DB  $db)
static

An expression for yesterday's date.

Parameters
DB$db
Returns
self