Jump to content


Photo

date calculations


  • Please log in to reply
1 reply to this topic

#1 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 27 July 2006 - 09:56 PM

quick question about dates calculation, I have it setup where when someone
I have paypal integration complete it records the date of the transaction depending on how much they paid it records either 30 or 365 days just as a number 30 or 365 I need to take the date, I have the date organized where it records m/d/y or mm/dd/yyyy actually and the timeperiod set to whichever is necessary I am pulling all this from the database for every login and trying to check the date, I ahve recorded, and the current date, and see how many days has passed and update accordingly
but if all the days has passed them I am going to remove some fields, and reset that back to paid = no
I don't want to know how to do anything I just wnated to know what is a good basis to start, being able to take 1 date and take another date and check to see how many days between those dates have passwed passed

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#2 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 27 July 2006 - 10:01 PM

This has been answered many times in this forum...
<?php
$date1 = strtotime('7/25/2006'); // number of seconds since 1-1-1970
$date2 = strtotime('1/1/2006');
$number_days = floor(($date1 - $date2)/86400); // 86400 = the number of seconds in a day
echo $number_days;
?>

Ken




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users