Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F102185323
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
Tue, Feb 18, 00:46
Size
1 KB
Mime Type
text/x-php
Expires
Thu, Feb 20, 00:46 (2 d)
Engine
blob
Format
Raw Data
Handle
24301858
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