Jump to content

date calculations


Ninjakreborn

Recommended Posts

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
Link to comment
https://forums.phpfreaks.com/topic/15838-date-calculations/
Share on other sites

This has been answered many times in this forum...
[code]<?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;
?>[/code]

Ken
Link to comment
https://forums.phpfreaks.com/topic/15838-date-calculations/#findComment-64857
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.