PHP 클래스 ExpressiveDate

상속: extends DateTime
파일 보기 프로젝트 열기: jasonlewis/expressive-date 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$defaultDateFormat string Default date format used when casting object to string.
$weekStartDay integer Starting day of the week, where 0 is Sunday and 1 is Monday.

공개 메소드들

메소드 설명
__call ( string $method, array $parameters ) : mixed Dynamically handle calls for date attributes and testers.
__construct ( string $time = null, string | DateTimeZone $timezone = null ) : void Create a new ExpressiveDate instance.
__toString ( ) : string Return the default date format when casting to string.
addDays ( integer $amount ) : ExpressiveDate Add a given amount of days.
addHours ( integer $amount ) : ExpressiveDate Add a given amount of hours.
addMinutes ( integer $amount ) : ExpressiveDate Add a given amount of minutes.
addMonths ( integer $amount ) : ExpressiveDate Add a given amount of months.
addOneDay ( ) : ExpressiveDate Add one day.
addOneHour ( ) : ExpressiveDate Add one hour.
addOneMinute ( ) : ExpressiveDate Add one minute.
addOneMonth ( ) : ExpressiveDate Add one month.
addOneSecond ( ) : ExpressiveDate Add one second.
addOneWeek ( ) : ExpressiveDate Add one week.
addOneYear ( ) : ExpressiveDate Add one year.
addSeconds ( integer $amount ) : ExpressiveDate Add a given amount of seconds.
addWeeks ( integer $amount ) : ExpressiveDate Add a given amount of weeks.
addYears ( integer $amount ) : ExpressiveDate Add a given amount of years.
copy ( ) : ExpressiveDate Return copy of expressive date object
endOfDay ( ) : ExpressiveDate Use the end of the day.
endOfMonth ( ) : ExpressiveDate Use the end of the month.
endOfWeek ( ) : ExpressiveDate Use the end of the week.
equalTo ( ExpressiveDate $date ) : boolean Determine if date is equal to another Expressive Date instance.
getDate ( ) : string Get a date string in the format of 2012-12-04.
getDateTime ( ) : string Get a date and time string in the format of 2012-12-04 23:43:27.
getDefaultDate ( ) : string Get a date string in the default format.
getDifferenceInDays ( ExpressiveDate $compare = null ) : string Get the difference in days.
getDifferenceInHours ( ExpressiveDate $compare = null ) : string Get the difference in hours.
getDifferenceInMinutes ( ExpressiveDate $compare = null ) : string Get the difference in minutes.
getDifferenceInMonths ( ExpressiveDate $compare = null ) : string Get the difference in months.
getDifferenceInSeconds ( ExpressiveDate $compare = null ) : string Get the difference in seconds.
getDifferenceInYears ( ExpressiveDate $compare = null ) : string Get the difference in years.
getLongDate ( ) : string Get a date string in the format of January 31st, 1991 at 7:45am.
getRelativeDate ( ExpressiveDate $compare = null ) : string Get a relative date string, e.g., 3 days ago.
getShortDate ( ) : string Get a date string in the format of Jan 31, 1991.
getTime ( ) : string Get a date string in the format of 07:42:32.
getWeekStartDay ( ) : integer Get the starting day of the week, where 0 is Sunday and 1 is Monday
greaterOrEqualTo ( ExpressiveDate $date ) : boolean Determine if date is greater than or equal to another Expressive Date instance.
greaterThan ( ExpressiveDate $date ) : boolean Determine if date is greater than another Expressive Date instance.
isWeekday ( ) : boolean Determine if day is a weekday.
isWeekend ( ) : boolean Determine if day is a weekend.
lessOrEqualTo ( ExpressiveDate $date ) : boolean Determine if date is less than or equal to another Expressive Date instance.
lessThan ( ExpressiveDate $date ) : boolean Determine if date is less than another Expressive Date instance.
make ( string $time = null, string | DateTimeZone $timezone = null ) : ExpressiveDate Make and return new ExpressiveDate instance.
makeFromDate ( integer $year = null, integer $month = null, integer $day = null, string | DateTimeZone $timezone = null ) : ExpressiveDate Make and return a new ExpressiveDate instance with defined year, month, and day.
makeFromDateTime ( integer $year = null, integer $month = null, integer $day = null, integer $hour = null, integer $minute = null, integer $second = null, string | DateTimeZone $timezone = null ) : ExpressiveDate Make and return a new ExpressiveDate instance with defined year, month, day, hour, minute, and second.
makeFromTime ( integer $hour = null, integer $minute = null, integer $second = null, string | DateTimeZone $timezone = null ) : ExpressiveDate Make and return a new ExpressiveDate instance with defined hour, minute, and second.
minusDays ( integer $amount ) : ExpressiveDate Minus a given amount of days.
minusHours ( integer $amount ) : ExpressiveDate Minus a given amount of hours.
minusMinutes ( integer $amount ) : ExpressiveDate Minus a given amount of minutes.
minusMonths ( integer $amount ) : ExpressiveDate Minus a given amount of months.
minusOneDay ( ) : ExpressiveDate Minus one day.
minusOneHour ( ) : ExpressiveDate Minus one hour.
minusOneMinute ( ) : ExpressiveDate Minus one minute.
minusOneMonth ( ) : ExpressiveDate Minus one month.
minusOneSecond ( ) : ExpressiveDate Minus one second.
minusOneWeek ( ) : ExpressiveDate Minus one week.
minusOneYear ( ) : ExpressiveDate Minus one year.
minusSeconds ( integer $amount ) : ExpressiveDate Minus a given amount of seconds.
minusWeeks ( integer $amount ) : ExpressiveDate Minus a given amount of weeks.
minusYears ( integer $amount ) : ExpressiveDate Minus a given amount of years.
notEqualTo ( ExpressiveDate $date ) : boolean Determine if date is not equal to another Expressive Date instance.
now ( ) : ExpressiveDate Use the current date and time.
sameAs ( ExpressiveDate $date ) : boolean Alias for ExpressiveDate::equalTo()
setDefaultDateFormat ( string $format ) : ExpressiveDate Set the default date format.
setTimestampFromString ( string $string ) : ExpressiveDate Sets the timestamp from a human readable string.
setTimezone ( string | DateTimeZone $timezone ) : ExpressiveDate Set the timezone.
setWeekStartDay ( integer | string $weekStartDay ) : void Set the starting day of the week, where 0 is Sunday and 1 is Monday.
startOfDay ( ) : ExpressiveDate Use the start of the day.
startOfMonth ( ) : ExpressiveDate Use the start of the month.
startOfWeek ( ) : ExpressiveDate Use the start of the week.
today ( ) : ExpressiveDate Use today's date and time at midnight.
tomorrow ( ) : ExpressiveDate Use tomorrow's date and time at midnight.
yesterday ( ) : ExpressiveDate Use yesterday's date and time at midnight.

보호된 메소드들

메소드 설명
getDateAttribute ( string $attribute ) : mixed Get a date attribute.
isDateAttribute ( string $attribute ) : mixed Syntactical sugar for determining if date object "is" a condition.
isFloat ( integer | float $amount ) : boolean Determine if a given amount is a floating point number.
modifyDays ( integer $amount, boolean $invert = false ) : ExpressiveDate Modify by an amount of days.
modifyFromInterval ( DateInterval $interval, boolean $invert = false ) : ExpressiveDate Modify from a DateInterval object.
modifyHours ( integer $amount, boolean $invert = false ) : ExpressiveDate Modify by an amount of hours.
modifyMinutes ( integer $amount, boolean $invert = false ) : ExpressiveDate Modify by an amount of minutes.
modifyMonths ( integer $amount, boolean $invert = false ) : ExpressiveDate Modify by an amount of months.
modifySeconds ( integer $amount, boolean $invert = false ) : ExpressiveDate Modify by an amount of seconds.
modifyWeeks ( integer $amount, boolean $invert = false ) : ExpressiveDate Modify by an amount of weeks.
modifyYears ( integer $amount, boolean $invert = false ) : ExpressiveDate Modify by an amount of Years.
parseSuppliedTimezone ( string | DateTimeZone $timezone ) : DateTimeZone Parse a supplied timezone.
setDateAttribute ( string $attribute, $value ) : mixed Set a date attribute.

메소드 상세

__call() 공개 메소드

Dynamically handle calls for date attributes and testers.
public __call ( string $method, array $parameters ) : mixed
$method string
$parameters array
리턴 mixed

__construct() 공개 메소드

Create a new ExpressiveDate instance.
public __construct ( string $time = null, string | DateTimeZone $timezone = null ) : void
$time string
$timezone string | DateTimeZone
리턴 void

__toString() 공개 메소드

Return the default date format when casting to string.
public __toString ( ) : string
리턴 string

addDays() 공개 메소드

Add a given amount of days.
public addDays ( integer $amount ) : ExpressiveDate
$amount integer
리턴 ExpressiveDate

addHours() 공개 메소드

Add a given amount of hours.
public addHours ( integer $amount ) : ExpressiveDate
$amount integer
리턴 ExpressiveDate

addMinutes() 공개 메소드

Add a given amount of minutes.
public addMinutes ( integer $amount ) : ExpressiveDate
$amount integer
리턴 ExpressiveDate

addMonths() 공개 메소드

Add a given amount of months.
public addMonths ( integer $amount ) : ExpressiveDate
$amount integer
리턴 ExpressiveDate

addOneDay() 공개 메소드

Add one day.
public addOneDay ( ) : ExpressiveDate
리턴 ExpressiveDate

addOneHour() 공개 메소드

Add one hour.
public addOneHour ( ) : ExpressiveDate
리턴 ExpressiveDate

addOneMinute() 공개 메소드

Add one minute.
public addOneMinute ( ) : ExpressiveDate
리턴 ExpressiveDate

addOneMonth() 공개 메소드

Add one month.
public addOneMonth ( ) : ExpressiveDate
리턴 ExpressiveDate

addOneSecond() 공개 메소드

Add one second.
public addOneSecond ( ) : ExpressiveDate
리턴 ExpressiveDate

addOneWeek() 공개 메소드

Add one week.
public addOneWeek ( ) : ExpressiveDate
리턴 ExpressiveDate

addOneYear() 공개 메소드

Add one year.
public addOneYear ( ) : ExpressiveDate
리턴 ExpressiveDate

addSeconds() 공개 메소드

Add a given amount of seconds.
public addSeconds ( integer $amount ) : ExpressiveDate
$amount integer
리턴 ExpressiveDate

addWeeks() 공개 메소드

Add a given amount of weeks.
public addWeeks ( integer $amount ) : ExpressiveDate
$amount integer
리턴 ExpressiveDate

addYears() 공개 메소드

Add a given amount of years.
public addYears ( integer $amount ) : ExpressiveDate
$amount integer
리턴 ExpressiveDate

copy() 공개 메소드

Return copy of expressive date object
public copy ( ) : ExpressiveDate
리턴 ExpressiveDate

endOfDay() 공개 메소드

Use the end of the day.
public endOfDay ( ) : ExpressiveDate
리턴 ExpressiveDate

endOfMonth() 공개 메소드

Use the end of the month.
public endOfMonth ( ) : ExpressiveDate
리턴 ExpressiveDate

endOfWeek() 공개 메소드

Use the end of the week.
public endOfWeek ( ) : ExpressiveDate
리턴 ExpressiveDate

equalTo() 공개 메소드

Determine if date is equal to another Expressive Date instance.
public equalTo ( ExpressiveDate $date ) : boolean
$date ExpressiveDate
리턴 boolean

getDate() 공개 메소드

Get a date string in the format of 2012-12-04.
public getDate ( ) : string
리턴 string

getDateAttribute() 보호된 메소드

Get a date attribute.
protected getDateAttribute ( string $attribute ) : mixed
$attribute string
리턴 mixed

getDateTime() 공개 메소드

Get a date and time string in the format of 2012-12-04 23:43:27.
public getDateTime ( ) : string
리턴 string

getDefaultDate() 공개 메소드

Get a date string in the default format.
public getDefaultDate ( ) : string
리턴 string

getDifferenceInDays() 공개 메소드

Get the difference in days.
public getDifferenceInDays ( ExpressiveDate $compare = null ) : string
$compare ExpressiveDate
리턴 string

getDifferenceInHours() 공개 메소드

Get the difference in hours.
public getDifferenceInHours ( ExpressiveDate $compare = null ) : string
$compare ExpressiveDate
리턴 string

getDifferenceInMinutes() 공개 메소드

Get the difference in minutes.
public getDifferenceInMinutes ( ExpressiveDate $compare = null ) : string
$compare ExpressiveDate
리턴 string

getDifferenceInMonths() 공개 메소드

Get the difference in months.
public getDifferenceInMonths ( ExpressiveDate $compare = null ) : string
$compare ExpressiveDate
리턴 string

getDifferenceInSeconds() 공개 메소드

Get the difference in seconds.
public getDifferenceInSeconds ( ExpressiveDate $compare = null ) : string
$compare ExpressiveDate
리턴 string

getDifferenceInYears() 공개 메소드

Get the difference in years.
public getDifferenceInYears ( ExpressiveDate $compare = null ) : string
$compare ExpressiveDate
리턴 string

getLongDate() 공개 메소드

Get a date string in the format of January 31st, 1991 at 7:45am.
public getLongDate ( ) : string
리턴 string

getRelativeDate() 공개 메소드

Get a relative date string, e.g., 3 days ago.
public getRelativeDate ( ExpressiveDate $compare = null ) : string
$compare ExpressiveDate
리턴 string

getShortDate() 공개 메소드

Get a date string in the format of Jan 31, 1991.
public getShortDate ( ) : string
리턴 string

getTime() 공개 메소드

Get a date string in the format of 07:42:32.
public getTime ( ) : string
리턴 string

getWeekStartDay() 공개 메소드

Get the starting day of the week, where 0 is Sunday and 1 is Monday
public getWeekStartDay ( ) : integer
리턴 integer

greaterOrEqualTo() 공개 메소드

Determine if date is greater than or equal to another Expressive Date instance.
public greaterOrEqualTo ( ExpressiveDate $date ) : boolean
$date ExpressiveDate
리턴 boolean

greaterThan() 공개 메소드

Determine if date is greater than another Expressive Date instance.
public greaterThan ( ExpressiveDate $date ) : boolean
$date ExpressiveDate
리턴 boolean

isDateAttribute() 보호된 메소드

Syntactical sugar for determining if date object "is" a condition.
protected isDateAttribute ( string $attribute ) : mixed
$attribute string
리턴 mixed

isFloat() 보호된 메소드

Determine if a given amount is a floating point number.
protected isFloat ( integer | float $amount ) : boolean
$amount integer | float
리턴 boolean

isWeekday() 공개 메소드

Determine if day is a weekday.
public isWeekday ( ) : boolean
리턴 boolean

isWeekend() 공개 메소드

Determine if day is a weekend.
public isWeekend ( ) : boolean
리턴 boolean

lessOrEqualTo() 공개 메소드

Determine if date is less than or equal to another Expressive Date instance.
public lessOrEqualTo ( ExpressiveDate $date ) : boolean
$date ExpressiveDate
리턴 boolean

lessThan() 공개 메소드

Determine if date is less than another Expressive Date instance.
public lessThan ( ExpressiveDate $date ) : boolean
$date ExpressiveDate
리턴 boolean

make() 공개 정적인 메소드

Make and return new ExpressiveDate instance.
public static make ( string $time = null, string | DateTimeZone $timezone = null ) : ExpressiveDate
$time string
$timezone string | DateTimeZone
리턴 ExpressiveDate

makeFromDate() 공개 정적인 메소드

Make and return a new ExpressiveDate instance with defined year, month, and day.
public static makeFromDate ( integer $year = null, integer $month = null, integer $day = null, string | DateTimeZone $timezone = null ) : ExpressiveDate
$year integer
$month integer
$day integer
$timezone string | DateTimeZone
리턴 ExpressiveDate

makeFromDateTime() 공개 정적인 메소드

Make and return a new ExpressiveDate instance with defined year, month, day, hour, minute, and second.
public static makeFromDateTime ( integer $year = null, integer $month = null, integer $day = null, integer $hour = null, integer $minute = null, integer $second = null, string | DateTimeZone $timezone = null ) : ExpressiveDate
$year integer
$month integer
$day integer
$hour integer
$minute integer
$second integer
$timezone string | DateTimeZone
리턴 ExpressiveDate

makeFromTime() 공개 정적인 메소드

Make and return a new ExpressiveDate instance with defined hour, minute, and second.
public static makeFromTime ( integer $hour = null, integer $minute = null, integer $second = null, string | DateTimeZone $timezone = null ) : ExpressiveDate
$hour integer
$minute integer
$second integer
$timezone string | DateTimeZone
리턴 ExpressiveDate

minusDays() 공개 메소드

Minus a given amount of days.
public minusDays ( integer $amount ) : ExpressiveDate
$amount integer
리턴 ExpressiveDate

minusHours() 공개 메소드

Minus a given amount of hours.
public minusHours ( integer $amount ) : ExpressiveDate
$amount integer
리턴 ExpressiveDate

minusMinutes() 공개 메소드

Minus a given amount of minutes.
public minusMinutes ( integer $amount ) : ExpressiveDate
$amount integer
리턴 ExpressiveDate

minusMonths() 공개 메소드

Minus a given amount of months.
public minusMonths ( integer $amount ) : ExpressiveDate
$amount integer
리턴 ExpressiveDate

minusOneDay() 공개 메소드

Minus one day.
public minusOneDay ( ) : ExpressiveDate
리턴 ExpressiveDate

minusOneHour() 공개 메소드

Minus one hour.
public minusOneHour ( ) : ExpressiveDate
리턴 ExpressiveDate

minusOneMinute() 공개 메소드

Minus one minute.
public minusOneMinute ( ) : ExpressiveDate
리턴 ExpressiveDate

minusOneMonth() 공개 메소드

Minus one month.
public minusOneMonth ( ) : ExpressiveDate
리턴 ExpressiveDate

minusOneSecond() 공개 메소드

Minus one second.
public minusOneSecond ( ) : ExpressiveDate
리턴 ExpressiveDate

minusOneWeek() 공개 메소드

Minus one week.
public minusOneWeek ( ) : ExpressiveDate
리턴 ExpressiveDate

minusOneYear() 공개 메소드

Minus one year.
public minusOneYear ( ) : ExpressiveDate
리턴 ExpressiveDate

minusSeconds() 공개 메소드

Minus a given amount of seconds.
public minusSeconds ( integer $amount ) : ExpressiveDate
$amount integer
리턴 ExpressiveDate

minusWeeks() 공개 메소드

Minus a given amount of weeks.
public minusWeeks ( integer $amount ) : ExpressiveDate
$amount integer
리턴 ExpressiveDate

minusYears() 공개 메소드

Minus a given amount of years.
public minusYears ( integer $amount ) : ExpressiveDate
$amount integer
리턴 ExpressiveDate

modifyDays() 보호된 메소드

Modify by an amount of days.
protected modifyDays ( integer $amount, boolean $invert = false ) : ExpressiveDate
$amount integer
$invert boolean
리턴 ExpressiveDate

modifyFromInterval() 보호된 메소드

Modify from a DateInterval object.
protected modifyFromInterval ( DateInterval $interval, boolean $invert = false ) : ExpressiveDate
$interval DateInterval
$invert boolean
리턴 ExpressiveDate

modifyHours() 보호된 메소드

Modify by an amount of hours.
protected modifyHours ( integer $amount, boolean $invert = false ) : ExpressiveDate
$amount integer
$invert boolean
리턴 ExpressiveDate

modifyMinutes() 보호된 메소드

Modify by an amount of minutes.
protected modifyMinutes ( integer $amount, boolean $invert = false ) : ExpressiveDate
$amount integer
$invert boolean
리턴 ExpressiveDate

modifyMonths() 보호된 메소드

Modify by an amount of months.
protected modifyMonths ( integer $amount, boolean $invert = false ) : ExpressiveDate
$amount integer
$invert boolean
리턴 ExpressiveDate

modifySeconds() 보호된 메소드

Modify by an amount of seconds.
protected modifySeconds ( integer $amount, boolean $invert = false ) : ExpressiveDate
$amount integer
$invert boolean
리턴 ExpressiveDate

modifyWeeks() 보호된 메소드

Modify by an amount of weeks.
protected modifyWeeks ( integer $amount, boolean $invert = false ) : ExpressiveDate
$amount integer
$invert boolean
리턴 ExpressiveDate

modifyYears() 보호된 메소드

Modify by an amount of Years.
protected modifyYears ( integer $amount, boolean $invert = false ) : ExpressiveDate
$amount integer
$invert boolean
리턴 ExpressiveDate

notEqualTo() 공개 메소드

Determine if date is not equal to another Expressive Date instance.
public notEqualTo ( ExpressiveDate $date ) : boolean
$date ExpressiveDate
리턴 boolean

now() 공개 메소드

Use the current date and time.
public now ( ) : ExpressiveDate
리턴 ExpressiveDate

parseSuppliedTimezone() 보호된 메소드

Parse a supplied timezone.
protected parseSuppliedTimezone ( string | DateTimeZone $timezone ) : DateTimeZone
$timezone string | DateTimeZone
리턴 DateTimeZone

sameAs() 공개 메소드

Alias for ExpressiveDate::equalTo()
public sameAs ( ExpressiveDate $date ) : boolean
$date ExpressiveDate
리턴 boolean

setDateAttribute() 보호된 메소드

Set a date attribute.
protected setDateAttribute ( string $attribute, $value ) : mixed
$attribute string
리턴 mixed

setDefaultDateFormat() 공개 메소드

Set the default date format.
public setDefaultDateFormat ( string $format ) : ExpressiveDate
$format string
리턴 ExpressiveDate

setTimestampFromString() 공개 메소드

Sets the timestamp from a human readable string.
public setTimestampFromString ( string $string ) : ExpressiveDate
$string string
리턴 ExpressiveDate

setTimezone() 공개 메소드

Set the timezone.
public setTimezone ( string | DateTimeZone $timezone ) : ExpressiveDate
$timezone string | DateTimeZone
리턴 ExpressiveDate

setWeekStartDay() 공개 메소드

Set the starting day of the week, where 0 is Sunday and 1 is Monday.
public setWeekStartDay ( integer | string $weekStartDay ) : void
$weekStartDay integer | string
리턴 void

startOfDay() 공개 메소드

Use the start of the day.
public startOfDay ( ) : ExpressiveDate
리턴 ExpressiveDate

startOfMonth() 공개 메소드

Use the start of the month.
public startOfMonth ( ) : ExpressiveDate
리턴 ExpressiveDate

startOfWeek() 공개 메소드

Use the start of the week.
public startOfWeek ( ) : ExpressiveDate
리턴 ExpressiveDate

today() 공개 메소드

Use today's date and time at midnight.
public today ( ) : ExpressiveDate
리턴 ExpressiveDate

tomorrow() 공개 메소드

Use tomorrow's date and time at midnight.
public tomorrow ( ) : ExpressiveDate
리턴 ExpressiveDate

yesterday() 공개 메소드

Use yesterday's date and time at midnight.
public yesterday ( ) : ExpressiveDate
리턴 ExpressiveDate

프로퍼티 상세

$defaultDateFormat 보호되어 있는 프로퍼티

Default date format used when casting object to string.
protected string $defaultDateFormat
리턴 string

$weekStartDay 보호되어 있는 프로퍼티

Starting day of the week, where 0 is Sunday and 1 is Monday.
protected int $weekStartDay
리턴 integer