PHP Class Ouzo\Utilities\Clock

Afficher le fichier Open project: letsdrink/ouzo Class Usage Examples

Méthodes publiques

Свойство Type Description
$dateTime
$freeze
$freezeDate DateTim\DateTime | Clock

Méthodes publiques

Méthode Description
__construct ( DateTime $dateTime )
at ( $date ) : Clock Obtains a Clock set to to a specific point.
format ( $format = null )
freeze ( null $date = null ) Freezes time to a specific point or current time if no time is given.
fromTimestamp ( $timestamp ) : Clock Obtains a Clock set to to a specific point using Unix timestamp.
getTimestamp ( )
isAfter ( Clock $other )
isAfterOrEqualTo ( Clock $other )
isBefore ( Clock $other )
isBeforeOrEqualTo ( Clock $other )
minusDays ( $days )
minusHours ( $hours )
minusMinutes ( $minutes )
minusMonths ( $months )
minusSeconds ( $seconds )
minusYears ( $years )
now ( ) : Clock Obtains a Clock set to the current time.
nowAsString ( string $format = null ) : string Returns current time as a string.
plusDays ( $days )
plusHours ( $hours )
plusMinutes ( $minutes )
plusMonths ( $months )
plusSeconds ( $seconds )
plusYears ( $years )
setTimezone ( $timezone )
toDateTime ( ) : DateTime Converts this object to a DateTime

Private Methods

Méthode Description
_modify ( $interval )

Method Details

__construct() public méthode

public __construct ( DateTime $dateTime )
$dateTime DateTime

at() public static méthode

Obtains a Clock set to to a specific point.
public static at ( $date ) : Clock
$date
Résultat Clock

format() public méthode

public format ( $format = null )

freeze() public static méthode

Freezes time to a specific point or current time if no time is given.
public static freeze ( null $date = null )
$date null

fromTimestamp() public static méthode

Obtains a Clock set to to a specific point using Unix timestamp.
public static fromTimestamp ( $timestamp ) : Clock
$timestamp
Résultat Clock

getTimestamp() public méthode

public getTimestamp ( )

isAfter() public méthode

public isAfter ( Clock $other )
$other Clock

isAfterOrEqualTo() public méthode

public isAfterOrEqualTo ( Clock $other )
$other Clock

isBefore() public méthode

public isBefore ( Clock $other )
$other Clock

isBeforeOrEqualTo() public méthode

public isBeforeOrEqualTo ( Clock $other )
$other Clock

minusDays() public méthode

public minusDays ( $days )

minusHours() public méthode

public minusHours ( $hours )

minusMinutes() public méthode

public minusMinutes ( $minutes )

minusMonths() public méthode

public minusMonths ( $months )

minusSeconds() public méthode

public minusSeconds ( $seconds )

minusYears() public méthode

public minusYears ( $years )

now() public static méthode

Obtains a Clock set to the current time.
public static now ( ) : Clock
Résultat Clock

nowAsString() public static méthode

Example: Clock::freeze('2011-01-02 12:34'); $result = Clock::nowAsString('Y-m-d'); Result: 2011-01-02
public static nowAsString ( string $format = null ) : string
$format string
Résultat string

plusDays() public méthode

public plusDays ( $days )

plusHours() public méthode

public plusHours ( $hours )

plusMinutes() public méthode

public plusMinutes ( $minutes )

plusMonths() public méthode

public plusMonths ( $months )

plusSeconds() public méthode

public plusSeconds ( $seconds )

plusYears() public méthode

public plusYears ( $years )

setTimezone() public méthode

public setTimezone ( $timezone )

toDateTime() public méthode

Converts this object to a DateTime
public toDateTime ( ) : DateTime
Résultat DateTime

Property Details

$dateTime public_oe property

public $dateTime

$freeze public_oe static_oe property

public static $freeze

$freezeDate public_oe static_oe property

public static DateTime,DateTim|Clock,Ouzo\Utilities $freezeDate
Résultat DateTim\DateTime | Clock