cc-2683: not using utc time

-context menu showing options display correctly
-edit show fills in correctly
-Now Playing view shows up correctly
This commit is contained in:
martin 2011-08-15 16:40:24 -04:00
parent 03f8163764
commit 41fd5f2543
7 changed files with 109 additions and 57 deletions

View file

@ -17,6 +17,18 @@ class DateHelper
{
return date("Y-m-d H:i:s", $this->_timestamp);
}
/**
* Get time of object construction in the format
* YYYY-MM-DD HH:mm:ss
*/
function getUtcTimestamp()
{
$dateTime = new DateTime("@".$this->_timestamp);
$dateTime->setTimezone(new DateTimeZone("UTC"));
return $dateTime->format("Y-m-d H:i:s");
}
/**
* Get date of object construction in the format
@ -157,5 +169,19 @@ class DateHelper
return $totalSeconds;
}
public static function ConvertToLocalDateTime($p_dateString){
$dateTime = new DateTime($p_dateString, new DateTimeZone("UTC"));
$dateTime->setTimezone(new DateTimeZone(date_default_timezone_get()));
return $dateTime;
}
public static function ConvertToLocalDateTimeString($p_dateString, $format="Y-m-d H:i:s"){
$dateTime = new DateTime($p_dateString, new DateTimeZone("UTC"));
$dateTime->setTimezone(new DateTimeZone(date_default_timezone_get()));
return $dateTime->format($format);
}
}