FreePgs.com Forum

FreePgs Related => Support Requests => Topic started by: Speedline Z on February 05, 2012, 06:56:30 PM

Title: php 5.3.0
Post by: Speedline Z on February 05, 2012, 06:56:30 PM
Any plans to upgrade plesk5 from php 5.2.17 to 5.3 ? .. I'd like to be able to use the datetime date_add() function if possible.

what im doing is
$mininductdate = new DateTime($initiationdate);
 $maxinductdate = new DateTime($initiationdate);
 $mininductdate->add(new DateInterval('P26D'));
 $maxinductdate->add(new DateInterval('P35D'));
 if($mininductdate < $inductiondate || $inductiondate > $maxinductdate)
 {
   printf('Submission failed: The Induction Date is not within 7 days of 30 days after Initiation date.<br>');
$indfail=1;
 }


The user provides the Initiation Date and Induction date.  The script checks to see if the induction date is 26 days to 35 days after the initiation date.
Title: Re: php 5.3.0
Post by: admin on February 07, 2012, 09:08:48 PM
There are no plans to upgrade the current systems at this time.

Is this something stored in a database table?  You can always use the SQL dateadd function if so.

Quote from: Speedline Z on February 05, 2012, 06:56:30 PM
Any plans to upgrade plesk5 from php 5.2.17 to 5.3 ? .. I'd like to be able to use the datetime date_add() function if possible.

what im doing is
$mininductdate = new DateTime($initiationdate);
 $maxinductdate = new DateTime($initiationdate);
 $mininductdate->add(new DateInterval('P26D'));
 $maxinductdate->add(new DateInterval('P35D'));
 if($mininductdate < $inductiondate || $inductiondate > $maxinductdate)
 {
   printf('Submission failed: The Induction Date is not within 7 days of 30 days after Initiation date.<br>');
$indfail=1;
 }


The user provides the Initiation Date and Induction date.  The script checks to see if the induction date is 26 days to 35 days after the initiation date.
Title: Re: php 5.3.0
Post by: Speedline Z on February 08, 2012, 12:41:09 AM
No.  the information is supplied by the user, and the page error checks to make sure the dates are valid before submitting them to the database.

I'll poke around and see if i can find another way to validate the dates...

EDIT: i found a solution


          $mininductdate = new DateTime($initiationdate);
  $maxinductdate = new DateTime($initiationdate);
  $checkinductdate = new DateTime($inductiondate);
  $mininductdate->modify('+26 days');
  $maxinductdate->modify('+35 days');
  if($mininductdate > $checkinductdate || $checkinductdate > $maxinductdate)
  {
    printf('Submission failed: The Induction Date is not within 7 days of 30 days after Initiation date.<br>');
$indfail=1;
  }


This works correctly.