Свойство | Type | Description | |
---|---|---|---|
$value | DateTime | null |
Méthode | Description | |
---|---|---|
__construct ( string | integer $time = "now", null | string $timezone = null ) | Constructor. | |
__toString ( ) : mixed | To string implementation. | |
createFromFormat ( string | integer $time, null | string $format = null ) : |
Create a DateTimeObject from the given $time and $format. | |
diff ( integer | string | DateTime | |
||
format ( string $format ) : string | Return date in the given format. | |
getDate ( null | string $format = null ) : string | Get date in full date format. | |
getDay ( null | string $format = null ) : string | Get day based on current date. | |
getHours ( null | string $format = null ) : string | Get hours based on current date. | |
getMeridiem ( null | string $format = null ) : string | Get meridiem (am, pm) based on current date. | |
getMinutes ( ) : string | Get minutes based on current date. | |
getMongoDate ( ) : MongoDB\BSON\UTCDatetime | Get MongoDate object | |
getMonth ( null | string $format = null ) : string | Get month based on current date. | |
getOffset ( ) : integer | Get the offset from current timezone to the UTC timezone in seconds. | |
getSeconds ( ) : string | Get seconds based on current date. | |
getTime ( null | string $format = null ) : string | Return time based on current date. | |
getTimeAgo ( null $from = null ) : string | Calculates the time passed between current date and $form (default: now). | |
getTimestamp ( ) : integer | Get UNIX timestamp based on current date. | |
getTimezone ( ) : string | Get the name of current timezone. | |
getWeek ( ) : integer | Get week number based on current date. | |
getYear ( null | string $format = null ) : string | Get year based on current date. | |
setFormat ( string $format ) | Set the date format. | |
setTimezone ( string | DateTimeZone $timezone ) | Set a new timezone for current date object. | |
val ( null $value = null ) : mixed | Return, or update, current standard objects value. |
Méthode | Description | |
---|---|---|
buildFormatterList ( ) | Reformats self::$formatters from array to ArrayObject. | |
createTimezone ( string | null $timezone = null ) : DateTimeZone | Create a DateTimeZone object for the given $timeZone. | |
getDateElement ( string $dateElement, null | string $format = null ) : string | Returns defined $dateElement in defined $format. | |
getDateObject ( ) : DateTime | null | Returns current \DateTime object. | |
getFormatFor ( string $dateElement ) : mixed | Returns format for defined $dateElement. | |
parseDateTimeFormat ( ) | This function parses the format provided by Config and sets the default formatting for getting date information like day, month, year, etc. | |
validateFormatFor ( string $dateElement, string $format ) : mixed | Checks if $format is a valid format for $dateElement. |
public __construct ( string | integer $time = "now", null | string $timezone = null ) | ||
$time | string | integer | A date/time string. List of available formats is explained here http://www.php.net/manual/en/datetime.formats.php |
$timezone | null | string | Timezone in which you want to set the date. Here is a list of valid timezones: http://php.net/manual/en/timezones.php |
public diff ( integer | string | DateTime | |
||
$time | integer | string | DateTime | |
Date to compare to. |
$absolute | boolean | Should the interval be forced to be positive? |
Résultat | Instance of ArrayObject containing time units (d,m,y,h,i,s) for keys and amounts for their values. |
public getMinutes ( ) : string | ||
Résultat | string | Minutes based on current date |
public getMongoDate ( ) : MongoDB\BSON\UTCDatetime | ||
Résultat | MongoDB\BSON\UTCDatetime |
public getSeconds ( ) : string | ||
Résultat | string | Seconds based on current date. |
public getTimeAgo ( null $from = null ) : string | ||
$from | null | Timestamp from where to calculate the offset. Default is now. |
Résultat | string | String describing the passed time. Example "4 hours ago". |
public getTimestamp ( ) : integer | ||
Résultat | integer | UNIX timestamp based on current date |
public getTimezone ( ) : string | ||
Résultat | string | The name of current timezone. |
public setTimezone ( string | DateTimeZone $timezone ) | ||
$timezone | string | DateTimeZone | Timezone to which you wish to offset. You can either pass \DateTimeZone object or a valid timezone string. For timezone string formats visit: http://php.net/manual/en/timezones.php |