PHP 클래스 WPDKDateTime

저자: =undo= ([email protected])
상속: extends WPDKObject
파일 보기 프로젝트 열기: wpxtreme/wpdk 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$__version string Override version

공개 메소드들

메소드 설명
accuracy ( string $v = false ) : string Return the accuracy date format
beginningOfWeek ( string $date, string $first_day = 'monday' ) : integer Returns number of days to start of this week.
compareDate ( ) TO DO
compareDatetime ( ) TO DO
daysToDate ( integer $date ) : float Return the days to a expiration date from now. Return the days to up ($date > now) or days expired ($date < now).
daysToWeekStart ( object $date, string $first_day = 'monday' ) : integer Returns number of days to start of this week.
elapsed ( $timestamp, $to = false, $w = 's' ) TODO proto
elapsedString ( integer $timestamp, boolean $hide_empty = true, integer $to, string $separator = ', ' ) : string This method is similar to WordPress human_time_diff(), with the different that every amount is display.
elapsed_string ( $timestamp, $hide_empty = true, $to, $separator = ' ' )
expirationDate ( string $date, integer $duration, string $duration_type ) : integer Return a timestamp as sum from $date and $duration/$duration_type
format ( string | integer $date, string $to = self::DATETIME_FORMAT_PHP ) : string Format a date time in your custom own format. The source format is auto-detect.
human ( string | integer $date, string $format = false ) : string Return an more readable human date format.
isExpired ( integer $exipration ) : boolean Return TRUE if $expiration date is past.
isInRangeDatetime ( string | integer $date_start, string | integer $date_expire, string $format = 'YmdHis', boolean $timestamp = false ) : boolean Return TRUE if now (today) is between from two date.
mySQLDate ( string | integer $date ) : string Return a date in MySQL format YYYY-MM-DD.
mySQLDateTime ( string | integer $datetime ) : string Return a date and time in MySQL format YYYY-MM-DD HH:MM:SS.
stripSecondsFromTime ( string $time ) : string Strip seconds from a date string (with time)
timeInRange ( integer $start, integer $expiry ) : boolean Return TRUE if now time() is between $start and $expry.
timeNewLine ( string $datetime ) : string Put a new line before time.

메소드 상세

accuracy() 공개 정적인 메소드

Return the accuracy date format
부터: 1.5.3
public static accuracy ( string $v = false ) : string
$v string Optional. Any acuracy 'seconds', 'hours', etc...
리턴 string

beginningOfWeek() 공개 정적인 메소드

Returns number of days to start of this week.
저자: =stid= ([email protected])
public static beginningOfWeek ( string $date, string $first_day = 'monday' ) : integer
$date string
$first_day string Optional. Start from `monday`
리턴 integer

compareDate() 공개 정적인 메소드

TO DO
public static compareDate ( )

compareDatetime() 공개 정적인 메소드

TO DO
public static compareDatetime ( )

daysToDate() 공개 정적인 메소드

Return the days to a expiration date from now. Return the days to up ($date > now) or days expired ($date < now).
public static daysToDate ( integer $date ) : float
$date integer A timestamp date
리턴 float

daysToWeekStart() 공개 정적인 메소드

Returns number of days to start of this week.
저자: =stid= ([email protected])
public static daysToWeekStart ( object $date, string $first_day = 'monday' ) : integer
$date object Date object
$first_day string
리턴 integer $date

elapsed() 공개 정적인 메소드

TODO proto
public static elapsed ( $timestamp, $to = false, $w = 's' )

elapsedString() 공개 정적인 메소드

For example if WordPress human_time_diff() display '10 hours', this method display '9 Hours 47 Minutes 56 Seconds'.
public static elapsedString ( integer $timestamp, boolean $hide_empty = true, integer $to, string $separator = ', ' ) : string
$timestamp integer Date from elapsed
$hide_empty boolean Optional. If TRUE '0 Year' will not return. Default TRUE.
$to integer Optional. Date to elapsed. If empty time() is used
$separator string Optional. Separator, default ', '.
리턴 string

elapsed_string() 공개 정적인 메소드

사용 중단: since 1.5.13 - Use elapsedString() instead
public static elapsed_string ( $timestamp, $hide_empty = true, $to, $separator = ' ' )

expirationDate() 공개 정적인 메소드

Return a timestamp as sum from $date and $duration/$duration_type
public static expirationDate ( string $date, integer $duration, string $duration_type ) : integer
$date string Start date in MySQL format as YYYY-MM-DD HH:MM:SS
$duration integer Duration
$duration_type string Type as `days`, `minutes`, `months
리턴 integer

format() 공개 정적인 메소드

Format a date time in your custom own format. The source format is auto-detect.
부터: 1.0.0
public static format ( string | integer $date, string $to = self::DATETIME_FORMAT_PHP ) : string
$date string | integer Source date string format. You can use a timestamp too.
$to string Optional. Output format. Default `Welf::DATETIME_FORMAT_PHP`
리턴 string

human() 공개 정적인 메소드

Return an more readable human date format.
public static human ( string | integer $date, string $format = false ) : string
$date string | integer String date or timestamp
$format string Optional. Default `get_option('date_format')`.
리턴 string

isExpired() 공개 정적인 메소드

Return TRUE if $expiration date is past.
public static isExpired ( integer $exipration ) : boolean
$exipration integer Timestamp date to check
리턴 boolean

isInRangeDatetime() 공개 정적인 메소드

Return TRUE if now (today) is between from two date.
사용 중단: since 1.5.16
public static isInRangeDatetime ( string | integer $date_start, string | integer $date_expire, string $format = 'YmdHis', boolean $timestamp = false ) : boolean
$date_start string | integer Start date in string or timestamp.
$date_expire string | integer Expire date in string or timestamp.
$format string Date format for start and expire.
$timestamp boolean TRUE if the date are in timestamp format.
리턴 boolean

mySQLDate() 공개 정적인 메소드

Return a date in MySQL format YYYY-MM-DD.
부터: 1.3.0
public static mySQLDate ( string | integer $date ) : string
$date string | integer A string date or timestamp.
리턴 string

mySQLDateTime() 공개 정적인 메소드

Return a date and time in MySQL format YYYY-MM-DD HH:MM:SS.
부터: 1.3.0
public static mySQLDateTime ( string | integer $datetime ) : string
$datetime string | integer A string date or timestamp.
리턴 string

stripSecondsFromTime() 공개 정적인 메소드

Strip seconds from a date string (with time)
public static stripSecondsFromTime ( string $time ) : string
$time string Time in hh:mm:ss
리턴 string

timeInRange() 공개 정적인 메소드

Return TRUE if now time() is between $start and $expry.
부터: 1.5.16
public static timeInRange ( integer $start, integer $expiry ) : boolean
$start integer Start date.
$expiry integer Expiry date.
리턴 boolean

timeNewLine() 공개 정적인 메소드

Put a new line before time.
public static timeNewLine ( string $datetime ) : string
$datetime string Date with time.
리턴 string

프로퍼티 상세

$__version 공개적으로 프로퍼티

Override version
public string $__version
리턴 string