PHP Class Jenssegers\Date\Date

Inheritance: extends Carbon\Carbon
Afficher le fichier Open project: jenssegers/date Class Usage Examples

Protected Properties

Свойство Type Description
$fallbackLocale string The fallback locale when a locale is not available.
$lastErrors array The errors that can occur.
$translator Symfony\Component\Translation\Translator The Translator implementation.

Méthodes publiques

Méthode Description
__construct ( string $time = null, string | DateTimeZon\DateTimeZone $timezone = null ) : Date Returns new DateTime object.
add ( string | DateInterva\DateInterval $interval ) : Date Adds an amount of days, months, years, hours, minutes and seconds to a Date object.
ago ( Date $since = null, boolean $absolute = false ) : string Alias for diffForHumans.
createFromFormat ( string $format, string $time, DateTimeZon\DateTimeZone | string $timezone = null ) : static Create a Carbon instance from a specific format.
diffForHumans ( Carbon\Carbon $since = null, boolean $absolute = false, $short = false ) : string Get the difference in a human readable format.
format ( string $format ) : string Returns date formatted according to given or predefined format.
getFallbackLocale ( ) : string Get the fallback locale.
getLocale ( ) : string Get the current translator locale.
getTranslator ( ) : Translator Return the Translator implementation.
make ( string $time = null, string | DateTimeZon\DateTimeZone $timezone = null ) : Date Create and return new Date instance.
parse ( string $time = null, string | DateTimeZon\DateTimeZone $timezone = null ) : Date Create a carbon instance from a string.
setFallbackLocale ( string $locale ) : void Set the fallback locale.
setLocale ( string $locale ) : void Set the current locale.
setTranslator ( Symfony\Component\Translation\TranslatorInterface $translator ) Set the Translator implementation.
sub ( string | DateInterva\DateInterval $interval ) : Date Subtracts an amount of days, months, years, hours, minutes and seconds from a DateTime object.
timespan ( Date $time = null, string | DateTimeZon\DateTimeZone $timezone = null ) : integer Gets the timespan between this date and another date.
translateTimeString ( string $time ) : string Translate a locale based time string to its english equivalent.
until ( Date $since = null ) : string Alias for diffForHumans.

Method Details

__construct() public méthode

Returns new DateTime object.
public __construct ( string $time = null, string | DateTimeZon\DateTimeZone $timezone = null ) : Date
$time string
$timezone string | DateTimeZon\DateTimeZone
Résultat Date

add() public méthode

Adds an amount of days, months, years, hours, minutes and seconds to a Date object.
public add ( string | DateInterva\DateInterval $interval ) : Date
$interval string | DateInterva\DateInterval
Résultat Date

ago() public méthode

Alias for diffForHumans.
public ago ( Date $since = null, boolean $absolute = false ) : string
$since Date
$absolute boolean Removes time difference modifiers ago, after, etc
Résultat string

createFromFormat() public static méthode

Create a Carbon instance from a specific format.
public static createFromFormat ( string $format, string $time, DateTimeZon\DateTimeZone | string $timezone = null ) : static
$format string
$time string
$timezone DateTimeZon\DateTimeZone | string
Résultat static

diffForHumans() public méthode

Get the difference in a human readable format.
public diffForHumans ( Carbon\Carbon $since = null, boolean $absolute = false, $short = false ) : string
$since Carbon\Carbon
$absolute boolean Removes time difference modifiers ago, after, etc
Résultat string

format() public méthode

Returns date formatted according to given or predefined format.
public format ( string $format ) : string
$format string
Résultat string

getFallbackLocale() public static méthode

Get the fallback locale.
public static getFallbackLocale ( ) : string
Résultat string

getLocale() public static méthode

Get the current translator locale.
public static getLocale ( ) : string
Résultat string

getTranslator() public static méthode

Return the Translator implementation.
public static getTranslator ( ) : Translator
Résultat Symfony\Component\Translation\Translator

make() public static méthode

Create and return new Date instance.
public static make ( string $time = null, string | DateTimeZon\DateTimeZone $timezone = null ) : Date
$time string
$timezone string | DateTimeZon\DateTimeZone
Résultat Date

parse() public static méthode

Create a carbon instance from a string.
public static parse ( string $time = null, string | DateTimeZon\DateTimeZone $timezone = null ) : Date
$time string
$timezone string | DateTimeZon\DateTimeZone
Résultat Date

setFallbackLocale() public static méthode

Set the fallback locale.
public static setFallbackLocale ( string $locale ) : void
$locale string
Résultat void

setLocale() public static méthode

Set the current locale.
public static setLocale ( string $locale ) : void
$locale string
Résultat void

setTranslator() public static méthode

Set the Translator implementation.
public static setTranslator ( Symfony\Component\Translation\TranslatorInterface $translator )
$translator Symfony\Component\Translation\TranslatorInterface

sub() public méthode

Subtracts an amount of days, months, years, hours, minutes and seconds from a DateTime object.
public sub ( string | DateInterva\DateInterval $interval ) : Date
$interval string | DateInterva\DateInterval
Résultat Date

timespan() public méthode

Gets the timespan between this date and another date.
public timespan ( Date $time = null, string | DateTimeZon\DateTimeZone $timezone = null ) : integer
$time Date
$timezone string | DateTimeZon\DateTimeZone
Résultat integer

translateTimeString() public static méthode

Translate a locale based time string to its english equivalent.
public static translateTimeString ( string $time ) : string
$time string
Résultat string

until() public méthode

Alias for diffForHumans.
public until ( Date $since = null ) : string
$since Date
Résultat string

Property Details

$fallbackLocale protected_oe static_oe property

The fallback locale when a locale is not available.
protected static string $fallbackLocale
Résultat string

$lastErrors protected_oe static_oe property

The errors that can occur.
protected static array $lastErrors
Résultat array

$translator protected_oe static_oe property

The Translator implementation.
protected static Translator,Symfony\Component\Translation $translator
Résultat Symfony\Component\Translation\Translator