Jump to content

Recommended Posts

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
Link to comment
https://forums.phpfreaks.com/topic/10474-php-time/
Share on other sites

[!--quoteo(post=377230:date=May 26 2006, 03:27 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ May 26 2006, 03:27 PM) [snapback]377230[/snapback][/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.
Link to comment
https://forums.phpfreaks.com/topic/10474-php-time/#findComment-39703
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.