本文整理汇总了PHP中Date_Calc::weekOfYear1st方法的典型用法代码示例。如果您正苦于以下问题:PHP Date_Calc::weekOfYear1st方法的具体用法?PHP Date_Calc::weekOfYear1st怎么用?PHP Date_Calc::weekOfYear1st使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Date_Calc
的用法示例。
在下文中一共展示了Date_Calc::weekOfYear1st方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: format2
//.........这里部分代码省略.........
break;
case "u":
case "U":
if ($this->ob_invalidtime) {
return $this->_getErrorInvalidTime();
}
$hn_unixtime = $this->getTime();
$hs_numberformat = substr($ps_format, $i + 1, 4);
// Allow sign if negative; allow all digits (specify nought);
// suppress padding:
//
$hs_unixtime = $this->_formatNumber($hn_unixtime, $hs_numberformat, 0, true, false, $ps_locale);
if (Pear::isError($hs_unixtime)) {
return $hs_unixtime;
}
$ret .= $hs_unixtime;
$i += 1 + strlen($hs_numberformat);
break;
case "w":
case "W":
// Check for 'WW' before 'W':
//
if (strtoupper(substr($ps_format, $i, 2)) == "WW") {
$hn_week = Date_Calc::weekOfYearAbsolute($this->day, $this->month, $this->year);
$hs_numberformat = substr($ps_format, $i + 2, 4);
$hs_week = $this->_formatNumber($hn_week, $hs_numberformat, 2, $hb_nopad, true, $ps_locale);
if (Pear::isError($hs_week)) {
return $hs_week;
}
$ret .= $hs_week;
$i += 2 + strlen($hs_numberformat);
} else {
if (strtoupper(substr($ps_format, $i, 2)) == "W1") {
$hn_week = Date_Calc::weekOfYear1st($this->day, $this->month, $this->year);
$hs_numberformat = substr($ps_format, $i + 2, 4);
$hs_week = $this->_formatNumber($hn_week, $hs_numberformat, 2, $hb_nopad, true, $ps_locale);
if (Pear::isError($hs_week)) {
return $hs_week;
}
$ret .= $hs_week;
$i += 2 + strlen($hs_numberformat);
} else {
if (strtoupper(substr($ps_format, $i, 2)) == "W4") {
$ha_week = Date_Calc::weekOfYear4th($this->day, $this->month, $this->year);
$hn_week = $ha_week[1];
$hs_numberformat = substr($ps_format, $i + 2, 4);
$hs_week = $this->_formatNumber($hn_week, $hs_numberformat, 2, $hb_nopad, true, $ps_locale);
if (Pear::isError($hs_week)) {
return $hs_week;
}
$ret .= $hs_week;
$i += 2 + strlen($hs_numberformat);
} else {
if (strtoupper(substr($ps_format, $i, 2)) == "W7") {
$ha_week = Date_Calc::weekOfYear7th($this->day, $this->month, $this->year);
$hn_week = $ha_week[1];
$hs_numberformat = substr($ps_format, $i + 2, 4);
$hs_week = $this->_formatNumber($hn_week, $hs_numberformat, 2, $hb_nopad, true, $ps_locale);
if (Pear::isError($hs_week)) {
return $hs_week;
}
$ret .= $hs_week;
$i += 2 + strlen($hs_numberformat);
} else {
// Code 'W':
//