Welcome to Discuss Everything Forums...

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed.


 

Tags for this Thread

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    samurai's Avatar
    Probation Member

    Status
    Offline
    Join Date
    May 2009
    Posts
    30
    Downloads
    0
    Uploads
    0

    How to get the interval between two timestamps in PHP?

    There are two timestamps.

    echo $time1;//The result is "2009-05-02 22:09:28"
    echo $time2;//The result is "2009-05-04 20:07:19“;
    How can I get the interval between $time1 and $time2?
    When I set
    $time3=$time2-$time1;
    I get 0.
    Please advise.

  2. #2
    $a_week_ago = time() - 604800;
    $now = time();
    $a_week_later = time() + 604800;

 

 

Quick Reply Quick Reply

Click here to log in


What color is our footer?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. subtracting 2 timestamps in PHP?
    By Jonathan in forum Discuss PHP
    Replies: 0
    Last Post: 01-16-2011, 04:15 AM
  2. forms in php involving timestamps?
    By Jaclyn S in forum Discuss PHP
    Replies: 0
    Last Post: 01-09-2011, 06:19 AM
  3. Replies: 0
    Last Post: 08-21-2010, 12:34 PM
  4. How do you compare two timestamps in php?
    By Jamaal E in forum Discuss PHP
    Replies: 0
    Last Post: 10-16-2009, 09:55 PM
  5. PHP E-mail Script with time interval?
    By Thomas in forum Discuss PHP
    Replies: 0
    Last Post: 04-30-2009, 12:49 AM

Bookmarks

Posting Permissions

  • You may post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts
  •