Skip to content

Instantly share code, notes, and snippets.

@tamboer
Created March 18, 2013 14:59
Show Gist options
  • Save tamboer/5187754 to your computer and use it in GitHub Desktop.
Save tamboer/5187754 to your computer and use it in GitHub Desktop.
Zend_date functions
<?php
$currentDate = new Zend_Date();
$currentDate->setDate($taskDistribution["date"], "yyyy-MM-dd");
$startTime = new Zend_Date();
$startTime->setTime($taskDistribution["start_time"], "HH:mm:ss");
$endTime = new Zend_Date();
$endTime->setTime($taskDistribution["end_time"], "HH:mm:ss");
if($endTime->toString('HH') == '00')
$endTime->setHour('24');
$taskDayTotal += $endTime->sub($startTime)->toValue()/60/60;
$taskWeekTotal=0;
if(isset($staff["TaskDistribution2"]))
foreach($staff["TaskDistribution2"] AS $taskDistribution){
$startTime = new Zend_Date();
$startTime->setTime($taskDistribution["start_time"], "HH:mm:ss");
$endTime = new Zend_Date();
$endTime->setTime($taskDistribution["end_time"], "HH:mm:ss");
if($endTime->toString('HH') == '00')
$endTime->setHour('24');
$taskWeekTotal += $endTime->sub($startTime)->toValue()/60/60;
}
if(isset($currentDate)){
$currentDate->setTime("12:00:00 AM")->toString();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment