Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-12-2010, 09:34 AM   PM User | #1
coolumanga
Regular Coder

 
Join Date: Sep 2010
Posts: 106
Thanks: 6
Thanked 0 Times in 0 Posts
coolumanga is an unknown quantity at this point
Subtracting Time Problem

Hi Again

i have a two time values

$to=09:00:00

$from=10:00:00

$diff= $from -$to ...........

how do i do this ..... and also i want get answer as minites

plzzzzzz help me for solve this

Last edited by coolumanga; 11-12-2010 at 09:43 AM..
coolumanga is offline   Reply With Quote
Old 11-12-2010, 09:47 AM   PM User | #2
BulletTimeBill
Regular Coder

 
Join Date: May 2010
Location: Bathurst, Australia
Posts: 180
Thanks: 1
Thanked 22 Times in 22 Posts
BulletTimeBill is an unknown quantity at this point
I'm not sure if there's an inbuilt function or something. But i'd use seconds to do the math then write a function to turn it into a string of a time format. Then there is this http://php.net/manual/en/function.strtotime.php if you want an actual time stamp....but then I always do stuff the hard way :P
BulletTimeBill is offline   Reply With Quote
Old 11-12-2010, 10:25 AM   PM User | #3
poyzn
Regular Coder

 
poyzn's Avatar
 
Join Date: Nov 2010
Posts: 265
Thanks: 2
Thanked 61 Times in 61 Posts
poyzn is on a distinguished road
if your php >= 5.3 you can use date_diff function
poyzn is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:25 PM.


Advertisement
Log in to turn off these ads.