Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    May 2003
    Location
    UK
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Finding out the days between 2 timestamps

    I'm sorry if this question already exists in these forums, I did try searching but found nothing........

    Anyway..... Say I have a ''bigint(20)" field in a mysql table, which holds a future timestamp using the time() function..
    Now, I would like to return the number of days from that field to the current date using time()...

    For example: You have 25 days left.......

    Example code which goes into the table:
    ( $member_expire_date = time() + (86400 * 25); )

    I know its simple, I'm just an amateur PHP coder (at the moment), so any assistance will be apreceiated.

    Hope you understood my question

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    Sheffield, UK
    Posts
    552
    Thanks
    0
    Thanked 0 Times in 0 Posts
    do it thru MySQL:

    "SELECT (TO_DAYS(FROM_UNIXTIME(datefield))-TO_DAYS(NOW())) AS daydiff FROM thetable"
    "To be successful in IT you don't need to know everything - just where to find it in under 30 seconds"

    (Me Me Me Me Me Me Me Me Me)


  •  

    Posting Permissions

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