Jump to content

Recommended Posts

Using two strtotime() functions is doubly-slow. If the original date can be understood by strtotime(), just do it all at once -

 

$duedate = date('m/d/y',strtotime("{$row['inv_submitted']} +30 days"));

 

If your inv_submitted field is in fact a DATE data type, just use the mysql DATE_ADD() function or directly add an INTERVAL in your query. To get the value formatted as a 'm/d/y', just use the mysql DATE_FORMAT() function in your query.

Sure..

 

For starters both of these declarations return strings..

So the first one will return, for example, 12/3/2009, and the second will return just add 30 days to todays date..

and you are trying to add them together which would never work...

$duedate = date("m/d/Y", strtotime($row['inv_submitted']));
$duedate = $duedate + date("m/d/Y", strtotime("+30 day"));

 

Have a read of this http://php.net/manual/en/function.strtotime.php for a better understanding of the strtotime function..

 

ah, makes sense I missed the adding strings together part, duh.. thanks.  :)

 

 

Sure..

 

For starters both of these declarations return strings..

So the first one will return, for example, 12/3/2009, and the second will return just add 30 days to todays date..

and you are trying to add them together which would never work...

$duedate = date("m/d/Y", strtotime($row['inv_submitted']));
$duedate = $duedate + date("m/d/Y", strtotime("+30 day"));

 

Have a read of this http://php.net/manual/en/function.strtotime.php for a better understanding of the strtotime function..

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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