Jump to content

Search the Community

Showing results for tags 'time'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

  1. Hey guys, Does anyone know a simple ,clean way of getting the time between a past date and todays date in seconds? I'm trying to figure out what the Linux Timestamp is about. I know it's the time since 1970 to now, but I don't see how I could use that here or why it's used. Perhaps someone could also give me a clue as to what it's mostly used for. THANKS!
  2. Hello, I am new to this site so please execuse my ignorance, I have piece of code that returns a time of 00:00:00 however I only want it to return 00:00. ie. 00:11:56 instead of 11:56. Can anyone help Thanks Time commenced: <select name="time_commenced" id="time_commenced"> <option value="<?php echo date('Hi'); ?>"><?php echo date('Hi'); ?></option> <?php $start = strtotime('0700'); $end = strtotime('2000'); ?> <?php for ($i = $start; $i <= $end; $i += 360) { ?> <option value="<?php echo date('Hi', $i); ?>"><?php echo date('Hi', $i); ?></option> <?php } ?> </select> Time completed: <select name="time_completed" id="time_completed"> <option value="<?php print date("Hi", mktime()+(6*60)); ?>"><?php print date("Hi", mktime()+(6*60));?></option> <?php for ($i = $start; $i <= $end; $i += 360) { ?> <option value="<?php echo date('Hi', $i); ?>"><?php echo date('Hi', $i); ?></option> <?php }
  3. Hi people, another quick question in regards to my webpage... Can anyone tell me the best way to display the current time in New York, London and Tokyo using php? I would like to use just hours/mins/secs (no dates) and for each city and have the time running live like a real clock. Any sugestions on how to achive this? Thank in advance.
  4. Hi all, Ok so i have a bit of a tricky question. I am using a query to return just time from a datetime variable '_sfm_form_submision_time_' based on a few conditions as follows: if(isset($_GET['mrn'])) { $Search = $_GET['mrn']; $Find_Query1 = mysql_query("SELECT DATE_FORMAT(_sfm_form_submision_time_,'%H:%i') AS time, SBP FROM obs WHERE mrn='$Search' AND DATE(_sfm_form_submision_time_) = $chosendate() order by time ASC"); if(!$Find_Query1) { die(mysql_error()); } while($row = mysql_fetch_assoc($Find_Query1)) { echo '<br/> TIME: '.$row['time']; echo '<br/> SBP: '.$row['SBP']; echo '<br/>'; } $numCount = mysql_num_rows($Find_Query1); if ($numCount < 1) { print("no sbp/time found for that mrn on chosen date"); } However, i want to make a correction to the returned 'time', for daylight saving. In the UK daylight saving time (British Summer Time - BST) starts at 1am on the last Sunday in March (1am GMT), and finishes at 2am BST (ie 1am GMT) on the last Sunday in October. To make things more complex, my server saves datetimes as 4 hours behind GMT (which i cant change), so i also want to correct for this. So, if the date '_sfm_form_submision_time_' was recorded was in daylight saving time I want to add 3 hours to 'time', otherwise i want to add 4 hours to 'time'. Does anyone have any clue how to do this?? Any help anyone can give would be amazing! Thanks Matt
  5. Table: cquestions -> cqid, cqtext, showdate. I want to update 'showdate' field to tomorrows date.. cqid cqtext showdate 200 q1 2013-05-22 201 q2 0000-00-00 202 q3 0000-00-00 the idea is to display only one question everyday. showdate is compared with the current date and display the first question q1. the starting date only store in db. now i want to update only the next row (q2)'s showdate to tomorrows date. next day wen q2 is displayed q3 will be updated to tomorrows date. today q1 displayed. db is like this. cqid cqtext showdate 200 q1 2013-05-22 201 q2 2013-05-23 202 q3 0000-00-00 tomorrow q2 displayed. then db cqid cqtext showdate 200 q1 2013-05-22 201 q2 2013-05-23 202 q3 2013-05-24 203 q4 0000-00-00 my code: $today=date("Y/m/d"); $tomorrow= date("Y-m-d", strtotime("tomorrow")); echo "<form method='post' id='submit' action='checkresult.php'>"; $sql="SELECT * FROM cquestions where showdate= '$today' limit 1"; $result=mysql_query($sql); while ($row = mysql_fetch_array($result)) { $cqid=mysql_result($result,"cqid"); $update1="update cquestions set showdate='$tomorrow' where showdate='0000-00-00' and cqid!='$cqid' order by cqid limit 1"; mysql_query($update1); echo "<p>" . $row['cqtext'] . "</p>"; $sql2="SELECT * FROM canswers where cqid=".$row['cqid']; $result2=mysql_query($sql2); while($row2=mysql_fetch_assoc($result2)){ echo "<input type='radio' name='".$row['cqid']."' value='".$row2['cqans']."' />".$row2['aatext']; } /*echo "<input type='hidden' name='email' value='email' />";*/ } echo"<input type='submit' id='submit' name='submit' value='Submit Answers' />"; echo "</form>"; ?> this code update the next row, but the problem is its executed every time page loads and update the next row... i want to execute the update query only once for the day. how to do it?
  6. A little background on the project I'm working on: I have a reasonably large number of values, over 500k rows worth. The values are generated per hour, per parent. I want to group these values by one of four time intervals: Month, week, day or hour, and get the average for this period. The challenge comes by the fact that I need to split the values into two different blocks, based upon whether the value was generated during the "day" or "night/weekend". So far I've come up with two different approaches to this: Have two fields in the table for saving the values, one for the "daytime" values and the other for "night time/weekend" values. This would allow me to run separate functions on the fields, without involving the date functions in MySQL. At the cost of having two fields for what is essentially the same type of data, and having to do the splitting in the pre-insert phase. Save all values in the same field, and then use MySQL's datetime functions with a CASE-WHEN to figure out in which block they belong. This approach seems to be the cleanest one in terms of database-design, but I fear it will put a lot of strain on the database. Especially since the SELECT statements will run more often than the insertion script. So the question is if I should go for the first approach, the second, or if there is some other solution to this that I've failed to grasp? I could really do with some expert help on this one. Example values: Desired output:
  7. Hello I have some serious date and time problem and i am working on it for 3 days without any hope. On my current job day change at 07:00 and i cannot calculate to see if person working or not if his job end after 00:00 My current code work fine if current time until 07:00am but fail after it. // Find end hour $working_hour = explode("~", "10:00~01:30"); // Explode it to hour and minute $ending = explode(":", $working_hour[1]); $mid = ($working_hour[1] > "07:00" && $working_hour[1] < "23:59") ? 1 : 0; $end_hour = mktime($ending[0], $ending[1], 0, date("n"), date("d") - $mid, date("Y")); $current = mktime(date("H"), date("i"), 0, date("n"), date("d"), date("Y")); // Return result if($end_hour < $current) return "-"; else if($row['left_min'] > 0) return "You have " .$row['left_min'] ." minutes left"; else return "you are done"; However; yesterday i wrote some code which works perfect for single count but fail in loop. Here it is; $array_for_hour = array(); $working_hour = explode("~", "10:00~01:30"); // if job end after midnight if($working_hour[1] > "23:59" || $working_hour[1] > "00:00") { $start_hour = strtotime($working_hour[0]); $end_hour = strtotime("23:59"); // Add into array every 30 minutes for($i = $start_hour; $i <= $end_hour; $i += 1800) { $array_for_hour = $i; } // Add another 30 minutes to comlete to 00:00 array_push($array_for_hour, $i); $midnight_start = strtotime("00:30"); $midnight_end = strtotime($working_hour[1]); // Add hours into array from midnight to actual end hour for($i = $midnight_start; $i <= $midnight_end; $i += 1800) { $array_for_hour = $i; } } else { $start_hour = strtotime($working_hour[0]); $end_hour = strtotime($this->bitis_saat); if($end_hour == "00:00") $end_hour = "23:59"; for($i = $start_hour; $i <= $end_hour; $i += 1800) { $this->arr[] = $i; } if($end_hour == "00:00") array_push($array_for_hour, $i); } Thanks for any help and advise. Regards
  8. I've seen similar solutions offered as to what I'm looking for but this is a slight twist that I need help with. In a mySQL table, I have a "time" (not timestamp) value. Example : 18:00:00 Unfortunately I don't have have date values to show which date this time was from. Here's what I want to do. Here's some sample data to work with: Current Time - 14:00 Time value # 1 from a mySQL query - 18:00:00 Time value # 2 from a mySQL query - 13:00:00 In PHP, I want to assume that, any time in the future is actually from the previous day. I then want to calculate the difference in time between the current time and any time value I pull from a query.and store that in a variable. For example, using time value #1 from above, the difference would be 20:00:00 (since it was 20 hours ago). Using time value #2, the difference would be 1:00:00 (only 1 hour). It sounds simple but I might be over analyzing my problem to figure this out. Thanks for any help offered - dan -
  9. hi any body know about find different from 2 table. example table 1 start time 12:23:21 table 2 start time 01:12:12 can any body help me..please
  10. Hello i was having trouble creating an array with regex. I have an excel sheet with various time formats including: 1h 51m 10.5s, 51m, 10m 10.5s, 5s and I need to convert the time down to minutes. Currently my regex is as follows and does not work: /(([0-9]{1,2})h)?(([0-9]{1,2})m)?(([0-9]{1,2}\.[0-9]{0,2})s)?/ Cold any one help a noob out, Im trying to separate each segment in to an array's cell so i can manipulate it later. My code for the entire function is as follows: public function convertToMinutes($subject) { //Regular Expression to remove text $pattern = '/(([0-9]{1,2})h)?(([0-9]{1,2})m)?(([0-9]{1,2}\.[0-9]{0,2})s)?/'; $numbers = preg_split($pattern, $subject); if (empty($numbers)) { $this -> _flash('warning'); $return['errors'][] = __(sprintf('Regular Expression is wrong'), true); } else { //There are only hours, minutes and seconds if (count($numbers) == 3) { $totalMinutes = 0; $hourMinutes = $numbers[0]; $minutes = $numbers[1]; $secondMinutes = $numbers[2]; $totalMinutes = $hourMinutes / 60; $totalMinutes = $totalMinutes + ($secondMinutes * 60); $totalMinutes = $totalMinutes + ($minutes); return $totalMinutes; debug(count($numbers)); } // There is only minutes and seconds elseif (count($numbers) == 2) { $totalMinutes = 0; $minutes = $numbers[0]; $secondMinutes = $numbers[1]; $totalMinutes = $totalMinutes + ($secondMinutes * 60); $totalMinutes = $totalMinutes + ($minutes); return $totalMinutes;debug(count($numbers)); } else { //Return the minutes return $numbers[0]; } } }
  11. Dear freaks . I need to make a program for my old primary school, just to help them out. I thought it was going to be quite simple but I have some major problems. The idea is this: Fill in a start time and start date(year,month,day hours,minutes) FIll in a end time and end date Safe both into a database, and pick them up. Let the movie/powerpoint/school information play without other human imput. The most important thing is just the information, wich I have ready in a file. How can I do this? Maybe mktime() is an option? Let me know and maybe show me some pieces of code you guys think is perfect! Greetings from the cold, little country called Holland! Dave
×
×
  • 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.