summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
4c4771f)
Provide at least _some_ error checking and a fall-back value for invalid
dates.
public static function epoch_to_gmdate($timestamp)
{
public static function epoch_to_gmdate($timestamp)
{
+ if (!is_numeric($timestamp) || is_nan($timestamp)) {
+ $timestamp = 0;
+ }
+
return gmdate('D, d M Y H:i:s', $timestamp) . ' GMT';
}
public static function str_to_gmdate($date)
{
$timestamp = strtotime($date);
return gmdate('D, d M Y H:i:s', $timestamp) . ' GMT';
}
public static function str_to_gmdate($date)
{
$timestamp = strtotime($date);
+ if (FALSE === $timestamp) {
+ $timestamp = 0;
+ }
+
return Tweeper::epoch_to_gmdate($timestamp);
}
return Tweeper::epoch_to_gmdate($timestamp);
}