Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





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 Complete Forum Thread with Replies

Related Forum Messages:
Converting Seconds To Hours:minutes
I have a large number (seconds) that I need to convert into hours and minutes and display it on the page like this:

Time
01:45

That would mean 01 hours and 45 minutes.

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 !
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 !
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 !
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 !
Determining Total Of Days, Hours And Seconds Between Two Dates
If i have two timestamps, is there a built in function to give me the different between the two as days, hours and seconds?

View Replies !
Convert UNIX Format Into An Hours:Minutes:Seconds Format
I have a a UNIX format number that I want to convert into an Hours:Minutes:Seconds format for a stopwatch/countdown timer script I'm writing.

I used date("H:i:s", ($time)), but the problem is, if the period I'm counting is above 24 hours, the Hours reset to 0. So If I was counting down 49 Hours, It's be displayed as 01:00:00 instead of 49:00:00.

View Replies !
Seconds To Minutes Conversion
I have a form where a user enters a value that will always be a number which represents minutes. I have the column that receives these values in the mysql table set to time format.

the problem that I'm having is when I send the value form the form to the mysql table the number is treated as seconds. how do I change it so that the value is treated as minutes and not seconds.

View Replies !
Converting Timestamp Into Minutes And Seconds
I am timing employees who take a test. I have the start time and end
time, which are unix epochs, and subtracing the start from the end
will give me a large number of seconds, for example 552.
I want to convert this into minutes and seconds.

View Replies !
Format The Time In Hours, Mins And Seconds
I can't seem to be format the time in hours, mins and seconds. I have looked at php.net/man. Does anyone know?

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 !
Deduct Date/time From Daste/time To Display Hours/days Difference
what i'm wanting to do is take away date logged from date closed therefore leaving the time between the 2 date/time stamps so that i can work out the average time later on and display as average time: 1day 2hours .

View Replies !
Find The Number Of Days?
situation:

$date1 = date("Y-m-d");
$date2 = "2007-01-12";

problem:

how to find the no of days between $date1 and $date2?

View Replies !
Find The Number Of Days
I have a datetime field in a mysql database and i want to output how many days, hours and minutes are left between the current date and the future date. So far i just convert the datettime to a timestamp like so: $start = strtotime($began);

Where $began is the current time, basically i just need to know how to convert a timestamp to days, hours ect If i was to minus the current timestamp from the future timestamp.

View Replies !
Using Date() To Find Out Days
Is it possible to use the php date function to find the number of days in given month. I know that date("d") gives the current date, but I have the month as a number and want to use this to find out the days in that month .

View Replies !
Find Last X Days Of Posts
I want to find the last 10 days worth of posts. i'm having a probably doing so with the time stamp: Code:

$sql = "SELECT p.*, pt.*, f.*
FROM phpbb_posts p, phpbb_posts_text pt, phpbb_forums f
WHERE pt.post_text LIKE '%$fname $lname%'
AND pt.post_id = p.post_id
AND f.forum_id = p.forum_id
AND f.forum_id = ྔ'
AND p.post_time >= date_format(date_add(CURRENT_TIMESTAMP(), interval 14 day),'%Y%m%d000000')
ORDER BY p.post_time DESC
LIMIT 0,1";

View Replies !
How I Could Compare Two Dates To Find The Number Of Days That Seperate Them.
I was wondering how I could compare two dates to find the number of days that seperate them. For instance, after a user signs up to my website, they would see a specific message for only a week. Obviously this is easy if they signed up on the 14th and today is the 16th, but what about if they signed up on the 29th, then I need to figure out for the next month.

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 !
Php.ini Sets Max Time To 90 Seconds, Yet I Get A "Max Execution Time Of 30 Seconds Exceeded"
This is weird. When I use getId3 to try to read meta tags out of
multimedia files, I get this error:

Fatal error: Maximum execution time of 30 seconds exceeded in /home/
httpd/vhosts/bluewallmultimedia.com/httpdocs/getid3/getid3/
getid3.lib.php on line 54

But if I run phpinfo(), I get this:

max_execution_time9595

and if I ssh to the server and look in php.ini, this is confirmed:

max_execution_time = 95 ; Maximum execution time of each script,
in seconds

This is on a RackSpace server, running RedHat. It's got Plesk
installed.

View Replies !
How Many Minutes
im trying to work out how many minutes have past and how many remain since the last datetime stamp...

does anyone know of any pre-existing functions for this before I reivent the wheel?

View Replies !
Run A Php Script Every 5-10 Minutes?
I have done with a script which will parse a website's xml format file and save(create own file name) that data into my server....

So, now i want to do a script that will run every 10 to 20 minutes that will run/execute my parser program becuase that website which provide me that xml data will update constantly. I have ask one off my friend and he tell me that i can run that php script with CORN and Telnet,and i have try it but cannot.

View Replies !
Time + 10 Minutes
$ganja=date("D dS M h:i A");

Assuming the above produced the following .

Tue 02nd Jan 11:55 PM

How do i add 10 minutes to it to produce this ? .

Wed 03rd Jan 00:05 AM

View Replies !
Run A Script Every X Minutes
Computer 1 sends every 10 minutes a file to Computer 2. This Computer 2 is actually
a web hosting service and i don't have a full control.

I want to run a script on this Comp2, that will check every 30 minutes, if the file
exist and its timestamp is no older than 30 minutes. If it's older, then sends me a
notification email (in case if Computer 1 freezes). All ok, but how can i run the script every X minutes?

View Replies !
Difference In Minutes
i have 2 time stamps i want to calculate the Difference in minutes.

View Replies !
Determine Minutes Ago
How could I take the time(); function and put it against an old value of time(); from a database and display "XX minutes ago".

View Replies !
Strtotime Missing A Zero In Minutes
I am working with strtotime. The following problem occurs when using this function:

View Replies !
How To Tell The Minutes Differance Between Two Dates()
Im using the date() function in this format:

date("d.m.y.H.i.s");

And im trying to work out a simple way to establish the differance in minutes between two sets of dates (as when 60 minutes hasnt passed since last use then they have to wait)

View Replies !
Convert Time To Every 5 Minutes
it's really a mathematical problem! when I get the minutes of today: PHP Code:

View Replies !
Converting Date To Minutes
I have $x="200504161035"
that is 10:35 on 16 April 2005.

My questuion: what is the *shortest* piece of code to convert that variable
to minutes? I have a feeling there is a PHP function that should be able to
do it but I cannot find it. The long way takes 5 lines of code.

View Replies !
How Can I Finalize A Session After Three Minutes?
How Can I finalize a session after three minutes?? How I use the
session_cache_expire. I've tried to use but i did't have too much
success...

View Replies !
Do A Countdown In Minutes To The Next Whole Hour?
How would I do a countdown in minutes to the next whole hour?

View Replies !
Cookies Are 2 Minutes Off In IE (with Setcookie)
I'm testing pages using cookies set with setcookie.  I suddenly started experiencing failures in IE. But Firefox was still fine. I noticed that it had to do with the cookie expiry time  (I have v. 7).  I had lowered the expiry threshold so I wouldn't have to keep clearing my browser cookies to test.

Is there some kind of minimum expiry time for IE??  Like 2 minutes...? Does IE shave two minutes off the top? Here's what I found:

time() + 3600 gives me 58 minutes in IE and 1 hour in Firefox
time() + 60 gives nothing I have time to notice in IE and a minute in firefox
time() + 120 gives me a couple seconds in IE and 2 min in firefox

Is this an IE "feature" or is it me that's doing something wrong?  I am new to this after all... example of how i set the cookies:

$hour = time() + 120;
setcookie(wpsite, $_POST['username'], $hour);

does work for the most part, just that little issue so far. I don't care whether it's fixable or not, it's just that I though I was going crazy at first when I was trying to troubleshoot the problem; could not figure out what was going on initially.

View Replies !
Set A Session To Expire In 20 Minutes
Let's say you set a session to expire in 20 minutes. Does reading and/or writing a session value bump that time up each time, or does it expire 20 minutes from when it was first created? I am pretty sure it is the former, but I want to check to make sure.

View Replies !
Session To Expire After 30 Minutes
I have a guestbook where I want the users to be able to delete their own posts. This is a part of my code: PHP Code:

session_cache_expire(30);
session_start();
    $_SESSION[('unique_id')] = session_id();
    $sessionen = $_SESSION[('unique_id')];

PHP Code:

// Here is decided if the user is able to delete the post
if ($sessionen == $rad[sess_id]) {
print ("<a href=gastbok.php?remove=$rad[id]><img src=../Ikoner/delete.gif alt=Delete this post width=27 height=14 border=0 align=middle onclick="return raderaInlagg()"></a>");
}

The thing is that I want the session to expire after 30 minutes (if the user forgets to close down the browser), but I can't get it to work. What am I doing wrong?

View Replies !
Captcha Every X Ammount Of Minutes
On my social networking site I want to check how many messages and comments a user has sent in say a 10 minute time, if this number is greater then 10 I want to display a captcha, I have the captcha code from other areas of the site so would like to implement the same code.


Would it be best to create a new table and everytime a message or comment is sent, update this table with a users ID number and the datetime of the action, then check this new table before posting a new message or comment, then daily like empty this table for size?

Below is my mail and comment table the most important thing is performance, need the best performance .....

View Replies !
Limits Posts Per 10 Minutes
im working on a homemade forum for my site and im trying to make a way to stop a person from being able to post more than 10 posts in 4 minutes (or what ever is a good time frame).

and if the user does this more than 3 times there account gets deleted can someone instruct me on how to do this.

View Replies !
Script Will Time Out After 90 Minutes
Just moved site to different web server. Previously no problems. Now, the script will time out after 90 minutes. I've set set_time_limit(0) but no effect.

View Replies !
Script Takes A Few Minutes To Run
I'm running a script that takes a few minutes to run. I set the max execution time in php.ini to 3600 seconds but the script still crashes after 8-17 minutes, saying "page cannot be found". I tried running it on 2 different machines more than once on each.

What can I change to keep it from crashing?

View Replies !
Cronjob Execute Each Minutes
when I execute a php script using a cronjob in this way

*/5 * * * * /usr/bin/php /usr/local/script/myscript.php

It works without problem and execute each minutes If I use

*/5 * * * * /usr/bin/php /usr/local/script/myscript.php > /dev/null

View Replies !
How Many Minutes Have Passed From A Given Time
i egt php to tell me in minutes how many minutes have passed from a given time for example i have a form that a user enters 2 times 1 when he took off and one where he landed i need php to work out how many minutes have elapsed from the take off time. currently i am useding the timespan command but i can get it to work out in minutes correctly i think. PHP Code:

$timespan =($landingtime + $takeofftime);

View Replies !
Adding Minutes To A Timestamp
How can I add 15 minutes to the previous event time (timestamp) to get the next event time. Note: This event time is not in a table.   

Straight forward adding the two values will probly not provide the correct result.

I can get the correct time with Mysql addtime($time, $duration) but that
is only good if the if info is in a table. Code:

View Replies !
Timestamp - Display Minutes?
<?php
$stamp = date("Y-m-d-h-m-s");
echo $stamp;
?>

My code is not quite working - everything but the minutes is working...what's the correct thing to put in to display minutes?

View Replies !
Logout After Idle X Minutes
i'm working on a login system.. and I was wondering... how's the best way to make sure the user get's automaticly logged out after, let's say 5 minutest idle?

i have a function called authUser() where I check cookies against the database... should I insert a code in there that sais somthing like this? Code:

View Replies !
Number Of Minutes Etc. Between Two Times
OK I have two timestamps. One is the value for the current time. The second is a time that a song was last played.

<?
$select = mysql_query("SELECT * FROM songs ORDER BY lastplayed DESC LIMIT 1"); // returns latest played song
$songinfo = mysql_fetch_array($select);

$todaysdate = date("YmdHis");
$songlastplay=$songinfo[lastplayed];
?>

Say for example the value of $songlastplay for this particular song was "20070213005812" and the current date were "20070213012056".

How would one work out how many days, hours, minutes and seconds were between these two dates?

View Replies !
Your Cookie Will Expire In XXX Minutes
I want to display a message that says "You cookie will expire in XXX minutes" based on a cookie called "cookiename".

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 !
Query For Date Submitted Was 10 Or More Minutes Ago
mysql query thur php, would this be correct to see if date submitted was 10 or more minutes ago date_submitted <=(NOW() - 3600)

View Replies !
Script Termination And Reload After 5 Minutes
Strange problem on a lamp installation: A script runs longer than 5
minutes and sends no output to the browser until it is finished. When
called at customer site it gets stopped after exactly 5 minutes and is
reloaded automatically 4 times, then it gives up. This is logged in
Apache access log.

I have no clue what causes the reload after 5 minutes of "no data
received". Could be the browser, could be the proxy. I even do not have
a problem with the behaviour, you could avoid that by sending something
to the browser periodically.

BUT: The script gets stopped completely after the 5 minute period. That
is what I dont like... No PHP log entry, no apache log entry about that.
Just like killed. "ignore_user_abort" is enabled in PHP configuration.

Any ideas what causes the script termination and how that can be avoided?

Configuration details:

View Replies !
MySql Question - Can I Add 90 Minutes To An INT Field
All the timestamps in my code are wrong by 90 minutes.

date INT(11),

I'd like to add 5400 to every date field in my database. Rather than do
this in PHP, I'm wondering if MySql has a command that would allow me
to do this directly.

View Replies !
Delete Record If Older Than 5 Minutes?
Can someone help me in writing a query command, to delete a record, if the last_update field on a record is older than 5 minutes?

My table has a last_update field, which holds a value as this for example: 2007-04-08 01:33:12

I need a query that when I access a php file, if a record is older than 5 minutes, it will delete it.

View Replies !
Removing Zero At Beginning Of DATE Minutes
I've been wondering how to solve this.. and I've seen it in quite a lot of places.. but.. How do I make the date minutes thing not show the first zero?

For example, I want:
"2 minutes ago.", instead of "02 minutes ago."

View Replies !
Changing A Download Link Every 5 Minutes?
I am hosting files that can be downloadable, but I don't want sites leached off of them so can the URL to the download expire after 5 minutes?

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved