Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

using timestamp


  • Please log in to reply
1 reply to this topic

#1 12Strings

12Strings

  • Members
  • 41 posts
  • OFFLINE
  •  
  • Local time:04:39 AM

Posted 15 June 2015 - 08:27 PM

Hi, I'm trying to update a database field (duedate)based on the value of a
variable (periodic). The below code echos the right results but not sure
how to use the value in "periodic" this and the "$date" in "duedate. Any
hints?
 

 // advance duedate =+ peridotic(number of months)
 $date = new DateTime("+6 months");
$date->modify("-" . ($date->format('F')+0) . " days");
echo $date->format('Y-m-d');
echo "<br />";
 // advance duedate one month
$date = new DateTime("+1 months");
$date->modify("-" . ($date->format('F')+0) . " days");
echo $date->format('Y-m-d');


BC AdBot (Login to Remove)

 


#2 cybersa

cybersa

  • Members
  • 31 posts
  • OFFLINE
  •  
  • Local time:04:09 PM

Posted 26 June 2015 - 02:29 AM

 

Hi, I'm trying to update a database field (duedate)based on the value of a
variable (periodic). The below code echos the right results but not sure
how to use the value in "periodic" this and the "$date" in "duedate. Any
hints?
 

 // advance duedate =+ peridotic(number of months)
 $date = new DateTime("+6 months");
$date->modify("-" . ($date->format('F')+0) . " days");
echo $date->format('Y-m-d');
echo "<br />";
 // advance duedate one month
$date = new DateTime("+1 months");
$date->modify("-" . ($date->format('F')+0) . " days");
echo $date->format('Y-m-d');

 

Can you explain more?

 

If you want to add days, or month to date.

See this funciton:http://php.net/manual/en/datetime.add.php


Edited by cybersa, 26 June 2015 - 02:29 AM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users