Sunday 15 September 2013

php - calculate date from utc time and percentage -


I am trying to complete the current percentage between dates given using the start date and today's date. The period between the two is calcuklated through the end date. To use this value in JavaScript, the Beginners = 2013-01-08 and expiration date = 2013-07-08 and today's real-time date test I am trying to change my result and see that it is returning the correct date. The code is as follows:

  $ period = (((stratetime ($ model ['projectand' '] - 1 * 86400) * 1000) - ((Stratetime ($ [' startout ']) - 1 * 86400) * 1000)); $ duration echo; echo "; $ burn = ((time () - 1 * 86400) * 1000) - ((Stratomet ($ model [ Start ']) - 1 * 86400 * 1000); Burn resonant $; echo "
" $ PBurned = $ burnt / $ period; resonance $ pBurned * 100; echo "& lt; br & gt; ; "; $ Time = $ time = starttime (($ date_from + $ pBurned); echo date (" Y-M-DH: I: S ", $ time);

Output is

  1.56348 e + 10 14212291 000 90.901648885819 1970-01-01 01:00:00   

Update:

  $ Today = Time ( ); $ StartData = Stromatium ($ model ['Start']); // $ enddate = strtotime ($ Model [ProjectEndDate ']); // $ diff_total = $ enddate - $ startdate; echo $ diff_total; echo " Lt; br & gt; "; $ Diff_today = $ today - $ startdate; echo $ diff_today; echo" & lt; br & gt; "; $ Percentage_date = Round (($ diff_today / $ diff_total) * 100,2); // resonant $ diff_today / $ diff_total; Echo per percent '%'; Go out();   

returns output

  15634800 14219916 90.95%   

Now what I want to do with this is 90.95 Calculation is from% of date of start and return

Search for percentages working for math I did not do any joke < Previous> $ today = new date time (); $ Startdate = new date time ("2013-06-16"); // $ model ['start'] $ end = new date time ("2013-06-26"); // $ model ['projectanddate'] $ diff_total = $ enddate- & gt; Diff ($ startdate) - & gt; Format ("% a"); $ Diff_today = $ today- & gt; Different ($ startdate) - & gt; Format ("% a"); $ Percentage_date = Round (($ diff_today / $ diff_total) * 100,2); Echo per percent '%'; // today

get a date percentage

  $ percent_to_get = 45; $ Percent_of_days = Floor (($ $ diff_total / 100 *) $ percent_ to_get); Echo Date ('Y-M-D', Stratom ($ start-AT- & gt; format ('Y-M-D'). "+ $ Percent_off_day"));    

No comments:

Post a Comment