Results 1 to 2 of 2

Thread: Php date calculation

  1. #1
    Join Date
    Jan 2010
    Posts
    2

    Php date calculation

    Hello all.
    how do i calculate the difference between dates. i.e if i make a transaction on 12/10/2007 and it is stored in my db. and the transaction was processed on 15/10/2007. is there a way i could write a code to calculate the difference with php? hope am making sense here!

    thanks

  2. #2
    Join Date
    Feb 2007
    Location
    Ireland
    Posts
    1,007
    If you convert the dates to unix timestamps, they are then converted to the number of seconds that have passed since 01/01/1970. As they are in a nice linear fashion, simple subtraction does the trick.

    The function you will need is: strtotime
    “The best thing about a boolean is even if you are wrong, you are only off by a bit.”

Similar Threads

  1. PHP date display format
    By ketanco in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 0
    Last Post: 12 Jul 2008, 03:14 PM
  2. JavaScript - Date Calculation?
    By web88js in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 1
    Last Post: 30 Dec 2006, 04:10 PM

Posting Permissions

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