SharkBait Posted June 21, 2006 Share Posted June 21, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/12555-need-to-figure-out-start-time/ Share on other sites More sharing options...
Buyocat Posted June 21, 2006 Share Posted June 21, 2006 Looks good, you can double check here if you want a reference:[a href=\"http://us3.php.net/mktime\" target=\"_blank\"]http://us3.php.net/mktime[/a] Quote Link to comment https://forums.phpfreaks.com/topic/12555-need-to-figure-out-start-time/#findComment-48098 Share on other sites More sharing options...
.josh Posted June 21, 2006 Share Posted June 21, 2006 wouldn't it be easier to just do like[code]$start = time();//do code stuff here or whatever$end = time();$lengthoftime = $end - $start;[/code] Quote Link to comment https://forums.phpfreaks.com/topic/12555-need-to-figure-out-start-time/#findComment-48111 Share on other sites More sharing options...
SharkBait Posted June 21, 2006 Author Share Posted June 21, 2006 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 :) Quote Link to comment https://forums.phpfreaks.com/topic/12555-need-to-figure-out-start-time/#findComment-48120 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.