Tribe__Tickets__Ticket_Object::get_date( string $date = '', bool $as_timestamp = true )
Get a DateTime object or a Timestamp date representation of the object, if the DateTime object is used the timezone from the event associated with the ticket is going to be used to have a more accurate timestamp
Contents
Parameters
- $date
-
(string) (Optional)
Default value: ''
- $as_timestamp
-
(bool) (Optional)
Default value: true
Return
(DateTime|false|int)
Source
File: src/Tribe/Ticket_Object.php
public function get_date( $date = '', $as_timestamp = true ) {
if ( $as_timestamp ) {
return strtotime( $date );
}
try {
$timezone = $this->get_event_timezone();
return new DateTime( $date, $timezone );
} catch ( Exception $exception ) {
return strtotime( $date );
}
}
Changelog
| Version | Description |
|---|---|
| 4.7.1 | Introduced. |