Jump to content

Need to figure out start time


SharkBait

Recommended Posts

It would but I need it to set the start time at 6:45am everyday.

So this is what I ended up with:
[code]
<?php

$TotalUnits = 0;
$sStart = mktime(06,45,0);
$sCurrent = mktime();

$betweenTime = substr(($sCurrent - $sStart) / 3600, 0, 3);

$startTime = date("Y-m-d 06:45:00");
$currentTime = date("Y-m-d h:m:s");

foreach($UNITS as $table => $name) {
  $strqry = "SELECT COUNT(*) as count FROM {$table} WHERE Real_Date = '{$startTime}' AND Real_Date <= '{$currentTime}'";
  $query = mysql_query($strqry) or die("MySQL Error: <br />{$strqry} <br /> ". mysql_error());
  $result = mysql_fetch_array($query, MYSQL_ASSOC);
  $TotalUnits = $TotalUnits + $result['count'];
}
echo substr($TotalUnits / $betweenTime, 0,2);
?>
[/code]
So now I can check between 6:45am and the current time, count the units that were entered and find the units per hour value :)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.