PHP 클래스 JBZoo\Utils\Dates

파일 보기 프로젝트 열기: jbzoo/utils 1 사용 예제들

공개 메소드들

메소드 설명
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