Jump to content

Need to figure out start time


SharkBait

Recommended Posts

Trying to figure out the mktime of 6:45am of this day.

I'm doing: mktime(6,45);

Is that right?

What I will be doing is using that as my start time, then finding out what my current time is and substracting the two to see how much time has passed since.

Link to comment
Share on other sites

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 :)
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.