Sunday, 24 June 2018

PHP- How to find Due dates in PHP and MySQL?

Hi Dear friends,
In This post we see, how to find next due date in easily.

PHP- How to find next due dates in PHP and MySQL?


for example, Finance Management application need to calculated next number due dates, 
Just analysis, what we do?
Step 1: Just given date to add number of days then we get next due date,

for example, 20/06/2018 is given date, 30 days after next First due date then just 30 Days, add next 60 days then we get second due date etc,

In additionally,

Given Loan Date : 20/06/2018
I Due Date : 20/07/2018
II Due Date : 20/08/2018
II Due Date : 20/09/2018

The above example, solved below code, Its very simple logic and easily use to your application.

Loan Date is Current Date then you can use below code


$loandate=date("d/m/Y");

else

You are using HTML5 Date control, then control return default format, so we convert to needed format in below format,

$timestamp = strtotime($loandate);
$lldate = date("d/m/Y", $timestamp);

$duedateinterval=30; // Assign how many date intervals. 1 month then 30, 1 week then 7

$nm=0;
for($i=1;$i<=5;$i++)
{
$nm=$nm+$duedateinterval;
echo $i."Due Date is=".date('d/m/Y', strtotime("+$nm days"));
}


Enjoy! Use code.. If any doubts comments here


No comments:

Post a Comment

What is AI- Artificial Intelligence - தமிழில்

Artificial Intelligence : Artificial intelligence leverages computers and machines to mimic the problem-solving and decision-making capabili...