PHP Class JBZoo\Utils\Dates

Afficher le fichier Open project: jbzoo/utils Class Usage Examples

Méthodes publiques

Méthode Description
factory ( mixed $time = null, null $timeZone = null ) : DateTime
human ( string | integer $date, string $format = 'd M Y H:i' ) : string
is ( string $date ) : boolean Check if string is date
isThisMonth ( string | integer $time ) : boolean Returns true if date passed is within this month.
isThisWeek ( string | integer $time ) : boolean Returns true if date passed is within this week.
isThisYear ( string | integer $time ) : boolean Returns true if date passed is within this year.
isToday ( string | integer $time ) : boolean Returns true if date passed is today.
isTomorrow ( string | integer $time ) : boolean Returns true if date passed is tomorrow.
isYesterday ( string | integer $time ) : boolean Returns true if date passed was yesterday.
sql ( null | integer $time = null ) : string Convert time for sql format
timezone ( mixed $timezone = null ) : DateTimeZone Return a DateTimeZone object based on the current timezone.
toStamp ( string | DateTim\DateTime $time = null, boolean $currentIsDefault = true ) : integer Convert to timestamp

Method Details

factory() public static méthode

public static factory ( mixed $time = null, null $timeZone = null ) : DateTime
$time mixed
$timeZone null
Résultat DateTime

human() public static méthode

public static human ( string | integer $date, string $format = 'd M Y H:i' ) : string
$date string | integer
$format string
Résultat string

is() public static méthode

Check if string is date
public static is ( string $date ) : boolean
$date string
Résultat boolean

isThisMonth() public static méthode

Returns true if date passed is within this month.
public static isThisMonth ( string | integer $time ) : boolean
$time string | integer
Résultat boolean

isThisWeek() public static méthode

Returns true if date passed is within this week.
public static isThisWeek ( string | integer $time ) : boolean
$time string | integer
Résultat boolean

isThisYear() public static méthode

Returns true if date passed is within this year.
public static isThisYear ( string | integer $time ) : boolean
$time string | integer
Résultat boolean

isToday() public static méthode

Returns true if date passed is today.
public static isToday ( string | integer $time ) : boolean
$time string | integer
Résultat boolean

isTomorrow() public static méthode

Returns true if date passed is tomorrow.
public static isTomorrow ( string | integer $time ) : boolean
$time string | integer
Résultat boolean

isYesterday() public static méthode

Returns true if date passed was yesterday.
public static isYesterday ( string | integer $time ) : boolean
$time string | integer
Résultat boolean

sql() public static méthode

Convert time for sql format
public static sql ( null | integer $time = null ) : string
$time null | integer
Résultat string

timezone() public static méthode

Return a DateTimeZone object based on the current timezone.
public static timezone ( mixed $timezone = null ) : DateTimeZone
$timezone mixed
Résultat DateTimeZone

toStamp() public static méthode

Convert to timestamp
public static toStamp ( string | DateTim\DateTime $time = null, boolean $currentIsDefault = true ) : integer
$time string | DateTim\DateTime
$currentIsDefault boolean
Résultat integer