本文整理汇总了PHP中OA_Dal::to2digitFormat方法的典型用法代码示例。如果您正苦于以下问题:PHP OA_Dal::to2digitFormat方法的具体用法?PHP OA_Dal::to2digitFormat怎么用?PHP OA_Dal::to2digitFormat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OA_Dal
的用法示例。
在下文中一共展示了OA_Dal::to2digitFormat方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sqlDate
/**
* Returns a valid SQL-formatted date for a current database.
* Examples:
* sqlDate(true, 2007, 2, 3) returns '2007-02-03'.
* sqlDate(false, 2007, 2, 3) returns OA_Dal::noDateValue().
* sqlDate(true, 2007, '-', 3) returns OA_Dal::noDateValue().
*
* @static
* @param boolean $validDate If true, the function will try to generate
* a valid date. Otherwise, it will ignore other arguments and just return
* an 'empty' date for this database.
* @param integer $year
* @param integer $month Month number from 1 to 12
* @param integer $day Day number from 1 to 28/29/30/31
* @return string If $validDate is true and all other parameters are valid
* integers, constructs a proper sql date string. If any of the $year,
* $month, $day is '-' or $validDate is false, returns a valid 'empty'
* date string for the database.
*/
function sqlDate($validDate, $year, $month, $day)
{
if (!$validDate || $year == '-' || $month == '-' || $day == '-') {
return OA_Dal::noDateValue();
}
$month = OA_Dal::to2digitFormat($month);
$day = OA_Dal::to2digitFormat($day);
return "{$year}-{$month}-{$day}";
}