Jump to content


Photo

PHP Time


  • Please log in to reply
2 replies to this topic

#1 Access

Access
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 26 May 2006 - 02:30 AM

Hello,

Im curious if their is a simple way to add and subtract between two times that are in the PHP date() format?

To clarify;

I have two variables;

$time1 and $time2;

both in the form date('H:i:s');

How can I achive the result that logically equates to;

$time3 = $time1 + $time1;

AND

$time3 = $time2 - $time1;

This doesnt appear to work.. is their an easy way to accomplish this without doing the whole thing manually.

Thanks
Access

#2 poirot

poirot
  • Members
  • PipPipPip
  • Advanced Member
  • 646 posts
  • LocationAustin, TX

Posted 26 May 2006 - 05:27 AM

What do you want exactly?

If you don't have the timestamp anymore (or aren't able to generate it using mktime()) I am afraid you are going to need to convert it to seconds and subtract / sum.
~ D Kuang

#3 Access

Access
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 28 May 2006 - 01:59 PM

[!--quoteo(post=377230:date=May 26 2006, 03:27 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ May 26 2006, 03:27 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
What do you want exactly?

If you don't have the timestamp anymore (or aren't able to generate it using mktime()) I am afraid you are going to need to convert it to seconds and subtract / sum.
[/quote]
Okay, so I have to do all Manipulation with Time stamps. I guess I was just under the impression that I could some how manipulate times using php date variables alones.

Thanks.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users