PHP Класс JBZoo\Utils\Dates

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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

Описание методов

factory() публичный статический Метод

public static factory ( mixed $time = null, null $timeZone = null ) : DateTime
$time mixed
$timeZone null
Результат DateTime

human() публичный статический Метод

public static human ( string | integer $date, string $format = 'd M Y H:i' ) : string
$date string | integer
$format string
Результат string

is() публичный статический Метод

Check if string is date
public static is ( string $date ) : boolean
$date string
Результат boolean

isThisMonth() публичный статический Метод

Returns true if date passed is within this month.
public static isThisMonth ( string | integer $time ) : boolean
$time string | integer
Результат boolean

isThisWeek() публичный статический Метод

Returns true if date passed is within this week.
public static isThisWeek ( string | integer $time ) : boolean
$time string | integer
Результат boolean

isThisYear() публичный статический Метод

Returns true if date passed is within this year.
public static isThisYear ( string | integer $time ) : boolean
$time string | integer
Результат boolean

isToday() публичный статический Метод

Returns true if date passed is today.
public static isToday ( string | integer $time ) : boolean
$time string | integer
Результат boolean

isTomorrow() публичный статический Метод

Returns true if date passed is tomorrow.
public static isTomorrow ( string | integer $time ) : boolean
$time string | integer
Результат boolean

isYesterday() публичный статический Метод

Returns true if date passed was yesterday.
public static isYesterday ( string | integer $time ) : boolean
$time string | integer
Результат boolean

sql() публичный статический Метод

Convert time for sql format
public static sql ( null | integer $time = null ) : string
$time null | integer
Результат string

timezone() публичный статический Метод

Return a DateTimeZone object based on the current timezone.
public static timezone ( mixed $timezone = null ) : DateTimeZone
$timezone mixed
Результат DateTimeZone

toStamp() публичный статический Метод

Convert to timestamp
public static toStamp ( string | DateTim\DateTime $time = null, boolean $currentIsDefault = true ) : integer
$time string | DateTim\DateTime
$currentIsDefault boolean
Результат integer