function dateRangeYears($mysqlDteBase, $lAgeYrsMin, $lAgeYrsMax, &$mysqlStartDate, &$mysqlEndDate)
{
    /*--------------------------------------------------------------------------------
       Let's say you want to find all the clients who were between 1 and 2 years
       of age on 2012-12-25:
    
          born           age on 2012-12-25
          ------------   -----------------
          2011-12-24             1
          2011-12-25             1
          2011-12-26             0
    
          2010-12-24             2
          2010-12-25             2
          2010-12-26             1
    
          2009-12-24             3
          2009-12-25             3
          2009-12-26             2
    
            > 2009-12-25  && <= 2011-12-25
    
    
       dateRangeYears('2010-12-25', 1, 2, &$mysqlStartDate, &$mysqlEndDate);
    
       returns $mysqlStartDate='2009-12-25', $mysqlEndDate='2011-12-25'
       ...
       the sql statement....
          WHERE NOT cr_bRetired
             AND cr_dteBirth > '.strPrepStr($mysqlStartDate).'
             AND cr_dteBirth <='.strPrepStr($mysqlEndDate).'
    --------------------------------------------------------------------------------*/
    numsMoDaYrMySQL($mysqlDteBase, $lMonth, $lDay, $lYear);
    $lMonthStart = $lMonth;
    $lDayStart = $lDay;
    $lYearStart = $lYear - ($lAgeYrsMax + 1);
    // leap year normalization
    normalizeDate($lMonthStart, $lDayStart, $lYearStart);
    $lMonthEnd = $lMonth;
    $lDayEnd = $lDay;
    $lYearEnd = $lYear - $lAgeYrsMin;
    // leap year normalization
    normalizeDate($lMonthEnd, $lDayEnd, $lYearEnd);
    $mysqlStartDate = strMoDaYr2MySQLDate($lMonthStart, $lDayStart, $lYearStart);
    $mysqlEndDate = strMoDaYr2MySQLDate($lMonthEnd, $lDayEnd, $lYearEnd);
}
Ejemplo n.º 2
0
function normalizeDateTime(&$lHour, &$lMinute, &$lSecond, &$lMonth, &$lDay, &$lYear)
{
    //---------------------------------------------------------------------
    //
    //---------------------------------------------------------------------
    //-----------------------------------------------
    // start with the seconds, then work our way up
    //-----------------------------------------------
    if ($lSecond >= 60) {
        $lMinute += (int) ($lSecond / 60);
        $lSecond = $lSecond % 60;
    } elseif ($lSecond < 0) {
        $lMinute -= (int) (-$lSecond / 60) + 1;
        if ($lSecond % 60 == 0) {
            ++$lMinute;
            $lSecond = 0;
        } else {
            $lSecond = 60 - -$lSecond % 60;
        }
    }
    //-----------------------------------------------
    // adjust minutes
    //-----------------------------------------------
    if ($lMinute >= 60) {
        $lHour += (int) ($lMinute / 60);
        $lMinute = $lMinute % 60;
    } elseif ($lMinute < 0) {
        $lHour -= (int) (-$lMinute / 60) + 1;
        if ($lMinute % 60 == 0) {
            ++$Hour;
            $lMinute = 0;
        } else {
            $lMinute = 60 - -$lMinute % 60;
        }
    }
    //-----------------------------------------------
    // adjust hours
    //-----------------------------------------------
    if ($lHour >= 24) {
        $lDay += (int) ($lHour / 24);
        $lHour = $lHour % 24;
    } elseif ($lHour < 0) {
        $lDay -= (int) (-$lHour / 24) + 1;
        if ($lHour % 24 == 0) {
            ++$lDay;
            $lHour = 0;
        } else {
            $lHour = 24 - -$lHour % 24;
        }
    }
    normalizeDate($lMonth, $lDay, $lYear);
}
								</td>

								<td class="thumbtext">
									<h2>
										<a href="<?php 
        echo $file->isDimensional ? '?' . urlencode($file->name) : $file->name;
        ?>
">
											<?php 
        echo $file->name;
        ?>
										</a>
									</h2>
									<p>
									<?php 
        echo normalizeDate($file->date);
        ?>
<br/>
										<?php 
        echo normalizeSize($file->size);
        ?>
<br/>
										<?php 
        if ($file->isDimensional) {
            ?>
											<?php 
            echo $file->width;
            ?>
 x <?php 
            echo $file->height;
            ?>
Ejemplo n.º 4
0
 public function transform($issue)
 {
     return ['vendor' => 'Redmine', 'id' => (int) $issue->id, 'title' => (string) $issue->subject, 'project' => ['id' => (int) $issue->project->attributes()->id, 'name' => (string) $issue->project->attributes()->name], 'status' => ['id' => (int) $issue->status->attributes()->id, 'name' => (string) $issue->status->attributes()->name], 'priority' => ['id' => (int) $issue->priority->attributes()->id, 'name' => (string) $issue->priority->attributes()->name], 'assigned_to' => ['id' => isset($issue->assigned_to) ? (int) $issue->assigned_to->attributes()->id : null, 'name' => isset($issue->assigned_to) ? (string) $issue->assigned_to->attributes()->name : null], 'created_at' => normalizeDate($issue->created_on), 'start_date' => normalizeDate(isset($issue->start_date) ? $issue->start_date : null), 'due_date' => normalizeDate(isset($issue->due_date) ? $issue->due_date : null), 'link' => getenv('REDMINE_HOST') . '/issues/' . (string) $issue->id];
 }
Ejemplo n.º 5
0
function getExistDates($startDate, $endDate)
{
    $gDateStart = normalizeDate($startDate);
    $gDateEnd = normalizeDate($endDate);
    $xml = '<existDates><dateRange>';
    $xml .= '<fromDate standardDate="' . $gDateStart . '">' . getDateTextual($gDateStart) . '</fromDate>';
    $xml .= '<toDate standardDate="' . $gDateEnd . '">' . getDateTextual($gDateEnd) . '</toDate>';
    $xml .= '</dateRange></existDates>';
    return $xml;
}
Ejemplo n.º 6
0
 public function transform(array $issue)
 {
     return ['vendor' => 'GitHub', 'id' => (int) $issue['number'], 'title' => $issue['title'], 'project' => ['id' => (int) $issue['user']['id'], 'name' => $issue['user']['login']], 'status' => ['id' => $issue['state'], 'name' => $issue['state']], 'priority' => ['id' => get_github_prio($issue['labels']), 'name' => get_github_prio($issue['labels'])], 'assigned_to' => ['id' => is_null($issue['assignee']) ? null : (int) $issue['assignee']['id'], 'name' => is_null($issue['assignee']) ? null : $issue['assignee']['login']], 'created_at' => normalizeDate($issue['created_at']), 'start_date' => normalizeDate($issue['created_at']), 'due_date' => null, 'link' => getenv('REDMINE_HOST') . '/issues/' . $issue['id']];
 }
Ejemplo n.º 7
0
 public function transform($case)
 {
     return ['vendor' => 'FogBugz', 'id' => (int) $case->ixBug, 'title' => (string) $case->sTitle, 'project' => ['id' => (int) $case->ixProject, 'name' => (string) $case->sProject], 'status' => ['id' => (int) $case->ixStatus, 'name' => (string) $case->sStatus], 'priority' => ['id' => (int) $case->ixPriority, 'name' => (string) $case->sPriority], 'assigned_to' => ['id' => (int) $case->ixPersonAssignedTo, 'name' => (string) $case->sPersonAssignedTo], 'created_at' => normalizeDate($case->dtOpened), 'start_date' => null, 'due_date' => normalizeDate($case->dtDue), 'link' => getenv('FOGBUGZ_HOST') . '/f/cases/' . (string) $case->ixBug];
 }
Ejemplo n.º 8
0
 public function transform(array $issue)
 {
     return ['vendor' => 'Redmine', 'id' => (int) $issue['id'], 'title' => $issue['subject'], 'project' => ['id' => (int) $issue['project']['id'], 'name' => $issue['project']['name']], 'status' => ['id' => (int) $issue['status']['id'], 'name' => $issue['status']['name']], 'priority' => ['id' => (int) $issue['priority']['id'], 'name' => $issue['priority']['name']], 'assigned_to' => ['id' => isset($issue['assigned_to']) ? (int) $issue['assigned_to']['id'] : null, 'name' => isset($issue['assigned_to']) ? $issue['assigned_to']['name'] : null], 'created_at' => normalizeDate($issue['created_on']), 'start_date' => normalizeDate(isset($issue['start_date']) ? $issue['start_date'] : null), 'due_date' => normalizeDate(isset($issue['due_date']) ? $issue['due_date'] : null), 'link' => getenv('REDMINE_HOST') . '/issues/' . $issue['id']];
 }