本文整理汇总了PHP中TTDate::getMinute方法的典型用法代码示例。如果您正苦于以下问题:PHP TTDate::getMinute方法的具体用法?PHP TTDate::getMinute怎么用?PHP TTDate::getMinute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TTDate
的用法示例。
在下文中一共展示了TTDate::getMinute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: inApplyFrequencyWindow
static function inApplyFrequencyWindow($frequency_id, $start_date, $end_date, $frequency_criteria = array())
{
/*
Frequency IDs:
20 => 'Annually',
25 => 'Quarterly',
30 => 'Monthly',
40 => 'Weekly',
100 => 'Specific Date', //Pay Period Dates, Hire Dates, Termination Dates, etc...
*/
if (!isset($frequency_criteria['month'])) {
$frequency_criteria['month'] = 0;
}
if (!isset($frequency_criteria['day_of_month'])) {
$frequency_criteria['day_of_month'] = 0;
}
if (!isset($frequency_criteria['day_of_week'])) {
$frequency_criteria['day_of_week'] = 0;
}
if (!isset($frequency_criteria['quarter_month'])) {
$frequency_criteria['quarter_month'] = 0;
}
if (!isset($frequency_criteria['date'])) {
$frequency_criteria['date'] = 0;
}
//Debug::Arr($frequency_criteria, 'Freq ID: '. $frequency_id .' Date: Start: '. TTDate::getDate('DATE+TIME', $start_date) .'('.$start_date.') End: '. TTDate::getDate('DATE+TIME', $end_date) .'('.$end_date.')', __FILE__, __LINE__, __METHOD__,10);
$retval = FALSE;
switch ($frequency_id) {
case 20:
//Annually
$year_epoch1 = mktime(TTDate::getHour($start_date), TTDate::getMinute($start_date), TTDate::getSecond($start_date), $frequency_criteria['month'], $frequency_criteria['day_of_month'], TTDate::getYear($start_date));
$year_epoch2 = mktime(TTDate::getHour($end_date), TTDate::getMinute($end_date), TTDate::getSecond($end_date), $frequency_criteria['month'], $frequency_criteria['day_of_month'], TTDate::getYear($end_date));
//Debug::Text('Year1 EPOCH: '. TTDate::getDate('DATE+TIME', $year_epoch1) .'('. $year_epoch1 .')', __FILE__, __LINE__, __METHOD__,10);
//Debug::Text('Year2 EPOCH: '. TTDate::getDate('DATE+TIME', $year_epoch2) .'('. $year_epoch2 .')', __FILE__, __LINE__, __METHOD__,10);
if ($year_epoch1 >= $start_date and $year_epoch1 <= $end_date or $year_epoch2 >= $start_date and $year_epoch2 <= $end_date) {
$retval = TRUE;
}
break;
case 25:
//Quarterly
//Handle quarterly like month, we just need to set the specific month from quarter_month.
if (abs($end_date - $start_date) > 86400 * 93) {
//3 months
$retval = TRUE;
} else {
for ($i = TTDate::getMiddleDayEpoch($start_date); $i <= TTDate::getMiddleDayEpoch($end_date); $i += 86400 * 1) {
if (self::getYearQuarterMonthNumber($i) == $frequency_criteria['quarter_month'] and $frequency_criteria['day_of_month'] == self::getDayOfMonth($i)) {
$retval = TRUE;
break;
}
}
}
break;
case 30:
//Monthly
//Make sure if they specify the day of month to be 31, that is still works for months with 30, or 28-29 days, assuming 31 basically means the last day of the month
if ($frequency_criteria['day_of_month'] > TTDate::getDaysInMonth($start_date) or $frequency_criteria['day_of_month'] > TTDate::getDaysInMonth($end_date)) {
$frequency_criteria['day_of_month'] = TTDate::getDaysInMonth($start_date);
if (TTDate::getDaysInMonth($end_date) < $frequency_criteria['day_of_month']) {
$frequency_criteria['day_of_month'] = TTDate::getDaysInMonth($end_date);
}
//Debug::Text('Apply frequency day of month exceeds days in this month, using last day of the month instead: '. $frequency_criteria['day_of_month'], __FILE__, __LINE__, __METHOD__,10);
}
$month_epoch1 = mktime(TTDate::getHour($start_date), TTDate::getMinute($start_date), TTDate::getSecond($start_date), TTDate::getMonth($start_date), $frequency_criteria['day_of_month'], TTDate::getYear($start_date));
$month_epoch2 = mktime(TTDate::getHour($end_date), TTDate::getMinute($end_date), TTDate::getSecond($end_date), TTDate::getMonth($end_date), $frequency_criteria['day_of_month'], TTDate::getYear($end_date));
//Debug::Text('Day of Month: '. $frequency_criteria['day_of_month'] .' Month EPOCH: '. TTDate::getDate('DATE+TIME', $month_epoch1) .' Current Month: '. TTDate::getMonth( $start_date ), __FILE__, __LINE__, __METHOD__,10);
//Debug::Text('Month1 EPOCH: '. TTDate::getDate('DATE+TIME', $month_epoch1) .'('. $month_epoch1 .') Greater Than: '. TTDate::getDate('DATE+TIME', ($start_date)) .' Less Than: '. TTDate::getDate('DATE+TIME', $end_date) .'('. $end_date .')', __FILE__, __LINE__, __METHOD__,10);
//Debug::Text('Month2 EPOCH: '. TTDate::getDate('DATE+TIME', $month_epoch2) .'('. $month_epoch2 .') Greater Than: '. TTDate::getDate('DATE+TIME', ($start_date)) .' Less Than: '. TTDate::getDate('DATE+TIME', $end_date) .'('. $end_date .')', __FILE__, __LINE__, __METHOD__,10);
if ($month_epoch1 >= $start_date and $month_epoch1 <= $end_date or $month_epoch2 >= $start_date and $month_epoch2 <= $end_date) {
$retval = TRUE;
}
break;
case 40:
//Weekly
$start_dow = self::getDayOfWeek($start_date);
$end_dow = self::getDayOfWeek($end_date);
if ($start_dow == $frequency_criteria['day_of_week'] or $end_dow == $frequency_criteria['day_of_week']) {
$retval = TRUE;
} else {
if ($end_date - $start_date > 86400 * 7) {
$retval = TRUE;
} else {
for ($i = TTDate::getMiddleDayEpoch($start_date); $i <= TTDate::getMiddleDayEpoch($end_date); $i += 86400) {
if (self::getDayOfWeek($i) == $frequency_criteria['day_of_week']) {
$retval = TRUE;
break;
}
}
}
}
break;
case 100:
//Specific date
Debug::Text('Specific Date: ' . TTDate::getDate('DATE+TIME', $frequency_criteria['date']), __FILE__, __LINE__, __METHOD__, 10);
if ($frequency_criteria['date'] >= $start_date and $frequency_criteria['date'] <= $end_date) {
$retval = TRUE;
}
break;
}
Debug::Text('Retval ' . (int) $retval, __FILE__, __LINE__, __METHOD__, 10);
//.........这里部分代码省略.........
示例2: getPartialPunchTotalTime
function getPartialPunchTotalTime($in_epoch, $out_epoch, $total_time, $user_id)
{
$retval = $total_time;
if ($this->isActiveTime($in_epoch, $out_epoch, $user_id) and $this->getIncludePartialPunch() == TRUE and ($this->getStartTime() > 0 or $this->getEndTime() > 0)) {
Debug::text(' Checking for Active Time with: In: ' . TTDate::getDate('DATE+TIME', $in_epoch) . ' Out: ' . TTDate::getDate('DATE+TIME', $out_epoch), __FILE__, __LINE__, __METHOD__, 10);
Debug::text(' Raw Start TimeStamp(' . $this->getStartTime(TRUE) . '): ' . TTDate::getDate('DATE+TIME', $this->getStartTime()) . ' Raw End TimeStamp(' . $this->getEndTime(TRUE) . '): ' . TTDate::getDate('DATE+TIME', $this->getEndTime()), __FILE__, __LINE__, __METHOD__, 10);
$start_time_stamp = TTDate::getTimeLockedDate($this->getStartTime(), $in_epoch);
$end_time_stamp = TTDate::getTimeLockedDate($this->getEndTime(), $in_epoch);
//Check if end timestamp is before start, if it is, move end timestamp to next day.
if ($end_time_stamp < $start_time_stamp) {
Debug::text(' Moving End TimeStamp to next day.', __FILE__, __LINE__, __METHOD__, 10);
$end_time_stamp = TTDate::getTimeLockedDate($this->getEndTime(), $end_time_stamp + 86400);
}
//Handle the last second of the day, so punches that span midnight like 11:00PM to 6:00AM get a full 1 hour for the time before midnight, rather than 59mins and 59secs.
if (TTDate::getHour($end_time_stamp) == 23 and TTDate::getMinute($end_time_stamp) == 59) {
$end_time_stamp = TTDate::getEndDayEpoch($end_time_stamp) + 1;
Debug::text(' End time stamp is within the last minute of day, make sure we include the last second of the day as well.', __FILE__, __LINE__, __METHOD__, 10);
}
$retval = 0;
for ($i = $start_time_stamp - 86400; $i <= $end_time_stamp + 86400; $i += 86400) {
//Due to DST, we need to make sure we always lock time of day so its the exact same. Without this it can walk by one hour either way.
$tmp_start_time_stamp = TTDate::getTimeLockedDate($this->getStartTime(), $i);
$tmp_end_time_stamp = TTDate::getTimeLockedDate($end_time_stamp, $tmp_start_time_stamp + ($end_time_stamp - $start_time_stamp));
//Use $end_time_stamp as it can be modified above due to being near midnight
if ($this->isActiveTime($tmp_start_time_stamp, $tmp_end_time_stamp, $user_id) == TRUE) {
$retval += TTDate::getTimeOverLapDifference($tmp_start_time_stamp, $tmp_end_time_stamp, $in_epoch, $out_epoch);
Debug::text(' Calculating partial time against Start TimeStamp: ' . TTDate::getDate('DATE+TIME', $tmp_start_time_stamp) . ' End TimeStamp: ' . TTDate::getDate('DATE+TIME', $tmp_end_time_stamp) . ' Total: ' . $retval, __FILE__, __LINE__, __METHOD__, 10);
} else {
Debug::text(' Not Active on this day: ' . TTDate::getDate('DATE+TIME', $i), __FILE__, __LINE__, __METHOD__, 10);
}
}
}
Debug::text(' Partial Punch Total Time: ' . $retval, __FILE__, __LINE__, __METHOD__, 10);
return $retval;
}