/* arrange the list in years */
function list_post_dates($uid, $wall) {
- $dnow = Temporal::timezoneNow(date_default_timezone_get(), 'Y-m-d');
+ $dnow = Temporal::localNow('Y-m-d');
$dthen = Item::firstPostDate($uid, $wall);
if (!$dthen) {
return $o;
}
- $cutoff_year = intval(Temporal::timezoneNow(date_default_timezone_get(), 'Y')) - $visible_years;
+ $cutoff_year = intval(Temporal::localNow('Y')) - $visible_years;
$cutoff = ((array_key_exists($cutoff_year, $ret))? true : false);
$o = replace_macros(get_markup_template('posted_date_widget.tpl'),[
// The view mode part is similiar to /mod/events.php
if ($mode == 'view') {
- $thisyear = Temporal::timezoneNow(date_default_timezone_get(), 'Y');
- $thismonth = Temporal::timezoneNow(date_default_timezone_get(), 'm');
+ $thisyear = Temporal::localNow('Y');
+ $thismonth = Temporal::localNow('m');
if (!$y) {
$y = intval($thisyear);
}
// The view mode part is similiar to /mod/cal.php
if ($mode == 'view') {
- $thisyear = Temporal::timezoneNow(date_default_timezone_get(), 'Y');
- $thismonth = Temporal::timezoneNow(date_default_timezone_get(), 'm');
+ $thisyear = Temporal::localNow('Y');
+ $thismonth = Temporal::localNow('m');
if (! $y) {
$y = intval($thisyear);
}
$resource_id = $a->argv[2];
if (!strlen($albname)) {
- $albname = Temporal::timezoneNow(date_default_timezone_get(), 'Y');
+ $albname = Temporal::localNow('Y');
}
if (x($_POST,'rotate') !== false &&
if (strlen($newalbum)) {
$album = $newalbum;
} else {
- $album = Temporal::timezoneNow(date_default_timezone_get(), 'Y');
+ $album = Temporal::localNow('Y');
}
}
}
/**
- * convert() shorthand for UTC now.
+ * convert() shorthand for timezoned now.
*
* @param string $format DateTime format string or Temporal constant
* @return string
return self::convert('now', $timezone, 'UTC', $format);
}
+ /**
+ * convert() shorthand for local now.
+ *
+ * @param string $format DateTime format string or Temporal constant
+ * @return string
+ */
+ public static function localNow($format = self::MYSQL)
+ {
+ return self::convert('now', date_default_timezone_get(), 'UTC', $format);
+ }
+
/**
* convert() shorthand for UTC now.
*
'October', 'November', 'December'
];
- $thisyear = self::timezoneNow(date_default_timezone_get(), 'Y');
- $thismonth = self::timezoneNow(date_default_timezone_get(), 'm');
+ $thisyear = self::localNow('Y');
+ $thismonth = self::localNow('m');
if (!$y) {
$y = $thisyear;
}
$started = false;
if (($y == $thisyear) && ($m == $thismonth)) {
- $tddate = intval(self::timezoneNow(date_default_timezone_get(), 'j'));
+ $tddate = intval(self::localNow('j'));
}
$str_month = day_translate($mtab[$m]);