php - DATEDIFF calculation between specific days without years -


I am trying to calculate interest to pay for every quarter from the date I bought.
Can DATEDIFF calculate without input of years and does it consistently calculate the days of each year between 2 dates?

Example: DATEDIFF Existing date and year without matured date

DATEDIFF ('10 -25 ',' * - 01 -01 '), while * is the year of the wild card. Can it be done or is there a way to do this?

Current code:

  // escape for security $ pdate = mysqli_real_escape_string ($ con, $ _POST ['pdate']); $ Mdate = mysqli_real_escape_string ($ cu, $ _POST ['mdate']); $ Amt = mysqli_real_escape_string ($ to $ _POST ['amt']); $ First = mysqli_real_escape_string ($ conn, $ _POST ['first']); $ Last = mysqli_real_escape_string ($ cu, $ _POST ['last']); $ Pid = mysqli_real_escape_string ($ conn, $ _POST ['pid']); $ Cno = mysqli_real_escape_string ($ conn, $ _POST ['cno']); $ Madd = mysqli_real_escape_string ($, $ _POST ['madd']); $ Option = mysqli_real_escape_string ($ con, $ _POST ['option']); $ Swc = mysqli_real_escape_string ($ cu, $ _POST ['swc']); $ Bacc = mysqli_real_escape_string ($ conn, $ _POST ['bacc']); $ Bank = mysqli_real_escape_string ($ conn, $ _POST ['bank']); $ Badd = mysqli_real_escape_string ($, $ _POST ['badd']); $ Bno = mysqli_real_escape_string ($ conn, $ _POST ['bno']); // Question with DATEDIFF calculation $ sql = "Include in contacts (today, q1, q, pdate, mdate, amt, first, last, pid, cno, madd, bene, swc, bacc, bank, badd, bno) Value ('$ mdate', '$ pdate'), ('DATEDIFF (' $ mdate ',' $ pdate ') *' $ AMT '/ 365 * 0.025),' $ pdate ',' $ mdate ',' $ Amt ',' $ first ',' $ last ',' $ paid ',' $ cno ',' $ madd ',' $ bene ',' $ swc ',' $ bacc ',' $ bank ',' $ Badd ',' $ Bno ') "; // Execute and query query error (! Mysqli_query ($ con, $ sql)) (die ('error:'. Mysqli_error ($ con));} Echo "Client records have been added to database!"; // Close MySQL mysqli_close ($ con);? & Gt;    

FYI, this is quite Not working (as you can see in SQL Bella). But this is a start

Assume that you have purchased a table -

  table purchase To make (buy_date date); purchase prices d Make pens ('2014-10-25');   

Create tables with the N rows, in future, if there is a number of years in the future, you will ever want to go to a query (this In the example, 5): Create the table generator (NAIT); Enter the generator values ​​(1), (2), (3), (4), (5);

Then you can do the following to get the date of interest at that interval for 5 years from the date of purchase, interest date and every punk Differences between the date of purchase on the date of the purchase:

  select_account, concat (@rw: = @rw + 1, '-01-01') as interest_date, datediff ( Join Cross Joiner in the Debt Android Generator (NRI: = 2014) as well as purchase_date, concat (@rw: = @rw + 1, '-01-01')) With cross joining from purchase, where n & lt; = 5 All interest_date, datediff (purchase_date, concat (@rx: = @rx + 1, '-04-01') as the purchase_date, concat (@ rx: = @ rx + 1, '-04 -01') )) Date_diff cross buy from purchase as (@ rx: = 2014) No. & Lt; = 5 Union All Purchases / Documents, Contact (@ $ 1, '-10-01') interest_date, dated (Purchase_date ,content (@: = @Re + 1, '-10-01')) Purchase As cross date date (include @: = 2014), join the R cross generator where n & lt; = 5 Order2   

See Bella:

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -