本文整理汇总了PHP中Date_Calc::gregorianToISO方法的典型用法代码示例。如果您正苦于以下问题:PHP Date_Calc::gregorianToISO方法的具体用法?PHP Date_Calc::gregorianToISO怎么用?PHP Date_Calc::gregorianToISO使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Date_Calc
的用法示例。
在下文中一共展示了Date_Calc::gregorianToISO方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: compare
}
}
if (php_sapi_name() != 'cli') {
echo "<pre>\n";
}
compare('20001122', Date_Calc::dateFormat(22, 11, 2000, '%Y%m%d'), 'dateFormat');
compare('20001122', Date_Calc::dateFormat('22', '11', '2000', '%Y%m%d'), 'dateFormat str');
compare('2001', Date_Calc::defaultCentury('1'), 'defaultCentury 1 str');
compare('2001', Date_Calc::defaultCentury(1), 'defaultCentury 1');
compare('1960', Date_Calc::defaultCentury(60), 'defaultCentury 2');
compare('2010', Date_Calc::defaultCentury(10), 'defaultCentury 3');
compare(2451871, Date_Calc::dateToDays('22', '11', '2000'), 'dateToDays str');
compare(2451871, Date_Calc::dateToDays(22, 11, 2000), 'dateToDays');
compare('20001122', Date_Calc::daysToDate(2451871), 'daysToDate');
compare('2000-47-3', Date_Calc::gregorianToISO('22', '11', '2000'), 'gregorianToISO str');
compare('2000-47-3', Date_Calc::gregorianToISO(22, 11, 2000), 'gregorianToISO');
compare(2451716.56767, Date_Calc::dateSeason('SUMMERSOLSTICE', 2000), 'dateSeason');
compare(date('Ymd'), Date_Calc::dateNow(), 'dateNow');
compare(date('Y'), Date_Calc::getYear(), 'getYear');
compare(date('m'), Date_Calc::getMonth(), 'getMonth');
compare(date('d'), Date_Calc::getDay(), 'getDay');
compare(327, Date_Calc::dayOfYear(22, 11, 2000), 'dayOfYear');
compare('November', Date_Calc::getMonthFullname(11), 'getMonthFullname');
compare('Nov', Date_Calc::getMonthAbbrname(11), 'getMonthAbbrname');
compare('Saturday', Date_Calc::getWeekdayFullname(1, 1, 2005), 'getWeekdayFullname');
compare('Sat', Date_Calc::getWeekdayAbbrname(1, 1, 2005), 'getWeekdayAbbrname');
compare(11, Date_Calc::getMonthFromFullName('November'), 'getMonthFromFullName');
compare(327, Date_Calc::dayOfYear('22', '11', '2000'), 'dayOfYear str');
compare('November', Date_Calc::getMonthFullname('11'), 'getMonthFullname str');
compare('Nov', Date_Calc::getMonthAbbrname('11'), 'getMonthAbbrname str');
compare('Saturday', Date_Calc::getWeekdayFullname('01', '01', '2005'), 'getWeekdayFullname str');
示例2: weekOfYear
/**
* Returns week of the year, first Sunday is first day of first week
*
* @param string day in format DD
* @param string month in format MM
* @param string year in format CCYY
*
* @access public
*
* @return integer $week_number
*/
function weekOfYear($day, $month, $year)
{
if (empty($year)) {
$year = Date_Calc::dateNow("%Y");
}
if (empty($month)) {
$month = Date_Calc::dateNow("%m");
}
if (empty($day)) {
$day = Date_Calc::dateNow("%d");
}
$iso = Date_Calc::gregorianToISO($day, $month, $year);
$parts = explode('-', $iso);
$week_number = intval($parts[1]);
return $week_number;
}
示例3: file
* Others usefull datas available from:
* http://www.merlyn.demon.co.uk/#dat
*/
$failed_test_data = false;
$wkno = file('wknotest.txt');
$cnt = sizeof($wkno);
for ($i = 0; $i < $cnt; $i++) {
$parts = explode(':', $wkno[$i]);
$weeksno[$parts[0]] = str_replace("\n", '', $parts[1]);
}
unset($wkno);
foreach ($weeksno as $date => $iso) {
$year = substr($date, 0, 4);
$month = substr($date, 4, 2);
$day = substr($date, 6);
$iso9601 = Date_Calc::gregorianToISO($day, $month, $year);
if ($iso9601 != $iso) {
$failed_test_data = true;
echo $date . '(' . $iso . ') =>' . $year . '-' . $month . '-' . $day . '=>' . $iso9601 . " : failed\n";
}
}
/**
* Bugs #19788
*/
$failed_test_19788 = false;
$pass1 = 2 == Date_Calc::weekOfYear(5, 1, 1998) ? true : false;
$pass2 = 2 == Date_Calc::weekOfYear(6, 1, 1998) ? true : false;
$pass3 = 2 == Date_Calc::weekOfYear(5, 1, 2004) ? true : false;
$pass4 = 2 == Date_Calc::weekOfYear(6, 1, 2004) ? true : false;
if (!($pass1 && $pass2 && $pass3 && $pass4)) {
$failed_test_19788 = true;