Counting Hours.
I have a Rota Submission page, which allows staff members to submit changes in rota, detailing their hours (start and finish), with additional hours if they're doing shifts, or an option for not being online at all. Code:
View Complete Forum Thread with Replies
Related Forum Messages:
Find Difference In Hours- Edit Code From Days To Hours?
I'm trying to find the difference in hours between one date from another, and my code currently finds the difference in days- could somebody edit the code to use hours instead of days? $expirationdate[0] = $row3[datetillcompletion]; $startdate[0] = date('Y-m-d'); $startdate = strtotime($startdate[0]); $expirationdate = strtotime($expirationdate[0]); $delta = $expirationdate - $startdate; $final=round($delta/86400);
View Replies !
Dates 23.00 Hours To 0.00 Hours.
I have the following code $day1 = mktime (0,0,0,1,1,$year); $days = ($week - 1) * 7; $d = strtotime ("+$days days", $day1); $dow = date('w', $d); $sunday = strtotime ("-$dow days", $d); $saturday = strtotime ("+6 days", $sunday); to give me the timestamp on sunday and saturday for a given week and year. The problem I have is that it's giving it at 23.00 hours when i need it at 0.00 hours. 1179010800 translates to Saturday, May 12th 2007, 23:00:00 (GMT) Can anyone see the problem?
View Replies !
Hours &
I'm selecting from a database a time looks like this: 1170229906. I'm trying to find a way to print the hours & minuted differences between each couple, when I'm using while ($rs=mysql_fetch_assoc($result)) {. For example, if the first time is 1170229906 and the second is 1170240253 - the result should be 2:53.
View Replies !
Add One Day (24 Hours) To A Date From
I'm having some trouble getting a grip on PHP's date handling. I've got my dates stored in a MySQL "datetime" column and I'm wondering, what is the best way to add one day (24 hours) to a date from that column?
View Replies !
Add Hours To A Date
I want to show a date coming from mysql (datetime format) to users, logging on from different timezones. Each user has it's own time:When a user logs on a session is created which hold the the time difference from the servertime e.g. user John has $_SESSION['mytime']=2; which means user John is in a timezone 2 hours later than the server. Now if a servertime gives a datetime value of 2002-20-10 18:15:05 How can I make it display 2 hours later, so it will show 2002-20-10 20:15:05? I know mysql has a Date_add function, but I want to keep my queries as they are already, and keep my datedifferences calculation in my include file. So I am looking for a PHP-coded solution.
View Replies !
Add 16 Hours To Datetime
I have a mysql database table that gets the "datetime" column automatically filled when a user fills in the php form page. $curdate = date("Y-m-d H:i:s"); Trouble is, the database server is in the USA which is 16 hours behind my time. Does anyone know a way to change this so that the 16 hours get added to the datetime?
View Replies !
Allow To Edit Within X Hours
I have data that is inserted into a database, one of the fields is named 'time_stamp' and is a "datetime; 0000-00-00 00:00:00" type. I was wondering how one could make an if statement that will show code (code is just the editing portion of the page) if the 'time_stamp' is less than the 'time_stamp' + 72 hours. Other wise, don't show the code and inform them that they can no longer edit.
View Replies !
Mins To Hours
i have a form when submitted hte php file the data is picked up by uses the timespan function to work out the time between two times given byt the user then it converts it into minutes. no on anouther page i want to be abe to convert it back into hours but when i put /60 after the variable it doesnt work it out correctly instead of the time being 11:59 hours it says 11.983333333333 . so how can i get it to convert back into 11:59?
View Replies !
Date() Being Off By 23 Hours
I have the Unix time stamp "1184616000" which I place into date('F j, Y h:i:s A', 1184616000) and I have tested it on two servers which produce "July 17, 2007 12:00:00 AM" but on some other servers it produces "July 16, 2007 01:00:00 PM". Since it is a pregenerated timestamp the date() output should be identical regardless of where it is executed. I am trying to figure out which is right and which is wrong. Can some people please try this out and let me know what you get?
View Replies !
Convert Hours
I've been trying to figure it out for hours and I'm tired because I know it isn't that difficult. guess it's just late and I can't think right. Anyways, so I have a lot of hours. Let's go with 8786 hours for example. I need to convert that to look like"___ years ____ days ____ hours".
View Replies !
24 Hours Dissapearal??
I have a page where it grabs stuff from one of my tables, and only like a few people have access to that page and I wanted to know if there was a way that like when the people that have access to take page selects one of the names or w/e it takes it off of the page for 24 hours.
View Replies !
Detect 6 Hours From Now
I'm doing a time ban and so when a user is banned obviously for datebanned i have time(). So on my unban list I basically want to take the time() function and add 6 hours to it so it still stays in the number format and then insert it into my database. How can I add hours and so forth accurately?
View Replies !
Hours To Man Days
I know this is prob easy but i've looked around and can't find what i am looking for, plus i'm a little bit of a newb. I have a group of total hours for a bunch of workers,, i.e each is like 280 hrs and i need to display these set of hours in another way, i need to display them in total man days instead and a man day for me is 6.5 hours now i know i can just divide 280 by 6.5 in php but that gives me something like: 43.076923076923076923076923076923 i need it to output in a format something like 43 days + 1 hour (or minutes if less than an hour)
View Replies !
Time Is Off By 2 Hours?
Whenever I create a new php file and use the date function like so <?php echo date("g:i"); ?> My browser outputs the correct time (I believe i am GMT-5:00) the first few times the file is opened, then the time becomes slow by 3 hours every time it loads (ex: 7:00pm my time shows up as 4:00pm on the browser screen). Is there a simple way to add 3 hours in the date function?
View Replies !
Adding Hours To Time
Whats the most effective way of adding 3 hours to a time in the format of 1:30 (h:mm), and turning it into a 24 hour format? I was thinking of turning it into a timestamp and working from there, but it seems a bit inefficient.
View Replies !
Finding Records Within The Last 48 Hours?
I can't seem to find anything on querying to find records dated within the last 48 hours. Not just two days/calendar dates, but 48 actual hours. I'm hoping to do something like: SELECT record FROM table WHERE postdate > (NOW - 48hrs) does that make sense?
View Replies !
Update Content Every 24 Hours
I'm looking for some basic guidance on the best method to automate the following task: 1) Pull some basic data / image from a database. 2) 24 hours later go back to database and redo the above to replace current content with new content. I've looked around and can't find scripts close enough to the above for me to work out the best way to approach it. I know it involves two basic concepts: 1) Some sort of date / time comparison to control the 24hr update sequence (no date or timestamp is included in the Db table to be used). 2) Some way to randomly pick replacement content from the Db by id number. Any suggestions or script samples are welcome. Not looking for any finished scripting here just pointers / samples on how best to approach it.
View Replies !
Adding 5 Hours To A Time Using PHP?
I would like to take a date of this format: DATE("Y-m-d H:i:s") and add 5 hours to it. Is there an easy way it can be done? I was thinking about just changing the string, but there's too much to acount for (leap years, etc).
View Replies !
Figuring Out When 2 Hours Have Passed
What I'd like to do is this. get a date and time and determine if it has been a certain amount of time since then. For example, I make an entry in the database of 11:00pm, and I want to periodically check, and if it is 1:00am or later, then I would update the database. Any suggestions?
View Replies !
Last Twelve Hours Echoed
I am so tried but can someone help and show me a basic way to only display the last twelve hours of results from the MySQL? I have a column with the time, how do I only show the last tweleve hours?
View Replies !
Server Time +8 Hours
I'm inputting a DATETIME timestamp of $now into my table <? $now = date("Y-m-d H:i:s"); ?> - which enters the exact time of update into the table. The problem is, is that I'm in Dublin (GMT) and the hosting server is in the US 7 hours behind. so if I entered data at exactly midday in dublin, the value displayed is 5am. Can someone guide me as to how I can alter the variable [b]$now[/b] to show Dublin time?
View Replies !
Date() Output 23 Hours Behind
Using a UNIX timestamp for "June 26, 2007, 12:00:00 AM" I compared the output of two calls to the date() function. One on a Windows server running PHP 5.2.1 and another on a Linux server running 5.0.5. The output on the Linux server is 23 hours behind the output of the Windows server, showing "June 25, 2007, 1:00:00 AM". The code is identical. Only the PHP and Apache version and the operating system vary. Time zone is not a factor as this is a pregenerated integer value for a future date. What could be causing this discrepancy?
View Replies !
Query Based On Last 24 Hours
i have tried googling for the syntax to run a query that can count the amount of new entries into a database based on todays date. I have a field in my database called sign_up_date which is of type datetime and has a default of 00-00-0000 00:00:00 $query = "SELECT COUNT(id) FROM users WHERE signup_date=........... ?
View Replies !
Make Cookie Last 24 Hours.
How do you change this code to expire in 24 hours instead of at a certian day and time? if ($whatever->whatever2['whatever3']) { if (!$_COOKIE['hacked']) { setcookie('hacked', Ƈ', 1143964800); } elseif ($_COOKIE['hacked'] < 3) { setcookie('hacked', $_COOKIE['hacked'] + 1, 1143964800); echo 'HTML CODE GOES HERE.' exit; } }
View Replies !
24 Hours Format Times
how do i go about working the elapsed time in hours beteween two 24 hour times: heres my general code PHP Code: <?php $to = $_POST['totime'];Â Â Â ///// first 24 hour time $land = $_POST['landtime'];Â Â Â ///// Second 24 hour time $ICAO = $_POST['LandICAO'];Â Â Â ///// Landing Airport $frame = $_POST['frame'];Â Â Â ///// a/c Frame Number $fnltime = "$land - $to"; echo $fnltime ?> problem being i need to to still be able to work it out if the person set one time as say 1800 and the 2nd time as 0200.
View Replies !
Delete Query Takes HOURS
why on EARTH would this query: Code: DELETE FROM `test_zip_assoc` WHERE id > 100000 take an entire day when there are 10 million records in this database: Code: +--------------+------------------+------+-----+---------------+----------------+ | Field | Type | Null | Key | Default | Extra | +--------------+------------------+------+-----+---------------+----------------+ | id | int(12) unsigned | | PRI | NULL | auto_increment | | f_id | int(12) unsigned | | | 0 | | | zip | varchar(5) | | | | | | lat_radians | decimal(12,11) | | MUL | 0.00000000000 | | | long_radians | decimal(12,11) | | MUL | 0.00000000000 | | +--------------+------------------+------+-----+---------------+----------------+
View Replies !
Redirecting - Session Lasting 24 Hours
I have this page called explore.php/index.php?random=explore, and there's this thing where you start a session lasting 24 hours saying that you have only that amount of time to go to these pages (index.php?random=place&cmd=$anyplace). In case you exit that page and go to a different page on the website, how can I make it so that when you go back to index.php?random=explore and the session still exists, it redirects back to the last place you were in index.php?random=place&cmd=$anyplace?
View Replies !
Expiry Time In Working Hours
Im writing a small application to time software projects. When a developer logs a query, they have to specify the estimated time it will take in working hours. I would like to state the estimated closing time, taking into account that the business works 09:00 - 17:00 Mon-Fri Code:
View Replies !
Finding Difference In Hours Between Two Times?
I recently switched this code to subtract days to hours, but it isn't working.. it's coming out with "343957987" hours and crazy stuff like that. Here's my code- $expirationdate[0] = $row3[datetillcompletion]; $startdate[0] = date("l, M dS (h:i a) "); $startdate = strtotime($startdate[0]); $expirationdate = strtotime($expirationdate[0]); $delta = $expirationdate - $startdate; $final=round($delta/3600);
View Replies !
Date() Function, Add A Couple Of Hours To It
The default timestamp that date() uses is the current time of the server which is processing the PHP document. So I wonder if I can add a coupla hours to this time? Say I need these 2 lines on my page: Here it is 1:00 pm, November 25, 2005 ------ date('g:i a, F j, Y'); There it is 4:00 pm, November 25, 2005 ----- date('g:i a, F j, Y', ???)
View Replies !
Find The Days, Hours, Minutes And Seconds?
I am making a function the will determine the amout of days, hours, minutes and seconds that are in a certian amout of seconds. For example: $all_seconds = 11405; I want to have this returned: $days = 0; $hours = 3; $min = 10; $sec = 5;
View Replies !
Time In Hours-Minutes-Seconds (accumulated)
Time in Hours-Minutes-Seconds (accumulated) How do I do this? I have minutes: $minutes_online = intval((time() - strtotime($data[$i]['dLastLogon']))/60); Ex: $minutes_online = 8758; How do I show this in Hour:Minute:Second - 10:32:22
View Replies !
Carry Out Function Every 24 Hours, Without Cron Jobs??
I'm trying to write a script which gets a random number every day, or 24 hours. I'm sure that the only way of doing this is using cron jobs, but I've checked with my host and they don't allow cron jobs Is there any other possible way of getting a script to activate every 24 hours?
View Replies !
Working With Dates In Hours Minutes Seconds ?
I have 2 dates in this format $timeold = date('m.d.y H:i:s', $timeold); $time2=(strtotime("now")); $time2 = date('m.d.y H:i:s', $time2); for example $timeold is 09.21.06 08:50:30 and $time2 is 09.21.06 09:00:38 When I make this $diff= $time2-$timeold; I receive this -608.21000003815 how can I transform this value (-608.21000003815) in hours minutes seconds ?
View Replies !
Expiry Time Expressed In Working Hours
Im writing a small application to time software projects. When a developer logs a query, they have to specify the estimated time it will take in working hours. I would like to state the estimated closing time, taking into account that the business works 09:00 - 17:00 Mon-Fri Example 1 Query logged at 15:00 on 23/01/2006 Estimated time = 3:00 Estimated completion time 10:00 on 24/01/2006 Example 2 Query logged at 09:00 on friday 27/01/2006 Estimated time = 12:00 Estimated completion time 12:00 on Monday 30/01/2006
View Replies !
Converting Time To 'days, Hours:minutes'
I'm trying to 'age' files but can't seem to figure it out. I'm getting the files modified value and doing: > time() - $mtime; to get back something like: > 18699668 How do I convert this value to 'xdays, yhours:zminutes'?
View Replies !
Make User Wait 2 Hours Before They Are Allowed To Do Something
i'm trying to make the user wait 2 hours before they are allowed to do something. I store the timestamp (time(); ) in field and then when the user wants to do something, i call the field with the timestamp that was stored in it and then compare it to see if 2 hours has elapsed. $newtime = storedtimestamp + something; $time = time(); if($newtime < $time) { echo"time is up. continue..."; } else { echo"You still have some minutes remaining."; }
View Replies !
Check Date And Time And Display A Link Between Certain Hours
I need to write a PHP script that can check the date and time, and if it falls in between certain hours to display a link, and if not display another link. The application is for a realaudio broadcast which goes live 7-9pm every wednesday. If it's not "live" then the link would be to the archive from the previous show.
View Replies !
|