Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F106190089
PhutilCalendarDateTime.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Mar 23, 09:58
Size
1 KB
Mime Type
text/x-php
Expires
Tue, Mar 25, 09:58 (2 d)
Engine
blob
Format
Raw Data
Handle
25134877
Attached To
rPHU libphutil
PhutilCalendarDateTime.php
View Options
<?php
abstract
class
PhutilCalendarDateTime
extends
Phobject
{
private
$viewerTimezone
;
private
$isAllDay
=
false
;
public
function
setViewerTimezone
(
$viewer_timezone
)
{
$this
->
viewerTimezone
=
$viewer_timezone
;
return
$this
;
}
public
function
getViewerTimezone
()
{
return
$this
->
viewerTimezone
;
}
public
function
setIsAllDay
(
$is_all_day
)
{
$this
->
isAllDay
=
$is_all_day
;
return
$this
;
}
public
function
getIsAllDay
()
{
return
$this
->
isAllDay
;
}
public
function
getEpoch
()
{
$datetime
=
$this
->
newPHPDateTime
();
return
(
int
)
$datetime
->
format
(
'U'
);
}
public
function
getISO8601
()
{
$datetime
=
$this
->
newPHPDateTime
();
if
(
$this
->
getIsAllDay
())
{
return
$datetime
->
format
(
'Ymd'
);
}
else
if
(
$this
->
getTimezone
())
{
// With a timezone, the event occurs at a specific second universally.
// We return the UTC representation of that point in time.
$datetime
->
setTimezone
(
new
DateTimeZone
(
'UTC'
));
return
$datetime
->
format
(
'Ymd
\\
THis
\\
Z'
);
}
else
{
// With no timezone, events are "floating" and occur at local time.
// We return a representation without the "Z".
return
$datetime
->
format
(
'Ymd
\\
THis'
);
}
}
public
function
newAbsoluteDateTime
()
{
$epoch
=
$this
->
getEpoch
();
$timezone
=
$this
->
getTimezone
();
return
PhutilCalendarAbsoluteDateTime
::
newFromEpoch
(
$epoch
,
$timezone
)
->
setIsAllDay
(
$this
->
getIsAllDay
())
->
setViewerTimezone
(
$this
->
getViewerTimezone
());
}
abstract
public
function
newPHPDateTimeZone
();
abstract
public
function
newPHPDateTime
();
abstract
public
function
getTimezone
();
}
Event Timeline
Log In to Comment