Jump to content

getting date and time difference


lenerd3000

Recommended Posts

<?php
$firsttime = strtotime(2008-05-06 12:00:00 );  # The first time
$secondtime = strtotime(2008-05-06 13:00:00);  # The last time
$difference = $secondtime - $firsttime;
$difference = $difference / 3400;
?>

Link to comment
Share on other sites

You would not be able to change that back to a time.

Yes you can. Use the date function

 

$unixtime = strtotime('+5 days'); // get the unix timestamp 5 days from now

// make time human readable
echo date('d-m-Y', $unixtime);

Link to comment
Share on other sites

If this is a timeclock, you'll need to consider just how the hour is broken up. Most companies pay you in 15 minute increments, and they have rules set to determine at what point the current 15 minute block will rollover to the next one. As in, punch in at 3:47 it rounds you to 3:45, but punch in at 3:55 and it rounds you up to 4.

 

Unless of course you want to pay them for exactly the amount of time worked and not round in 15 minute blocks.

Link to comment
Share on other sites

rounding up is really my problem. since there is no fixed time for some of the employees. i decided to make a schedule of work as my reference and will be encoded in the database but since they can assign another employee to any time, any day, that will be useless. i work in a call center so there are agents who will be rescheduled on night at this time or day at that time. if i make it to 9 working hours, some can extend to 15hours or how about it is overtime.

Link to comment
Share on other sites

That's just short of robbing somebody. No I take it back that's worst.

 

It may not be the most liked practice, but it's fairly typical from what I've seen. Personally I'm not going to make a big deal out of being "robbed" of a few minutes. I just learn the pattern of the time clock and take advantage of it, haha.

 

 

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.