By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,720 Members | 2,237 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,720 IT Pros & Developers. It's quick & easy.

Need help for date calculating

P: 2
any body please help me..

i wants to add months to a fixed date...

ie i wants to add 2 month to 2007-05-18 ..

pls help...
May 18 '07 #1
Share this Question
Share on Google+
4 Replies

P: 26
u can use mktime

mktime(hour, minute, second, month, day, year);

just add number then put it as month parameter
May 18 '07 #2

Expert 2.5K+
P: 3,235
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $date = new DateTime("2006-12-12");
  3. $date->modify("+1 day");
  4. echo $date->format("Y-m-d");
  5. ?> 
May 18 '07 #3

P: 2

it is not working...

in my form starting date is a user input as 2007-06-06 and increment field(month) is also user input.
user can enter stating date and no of months as 1,2,....

according to this month i have to calculate the ending date???/

eg) starting date :2007-06-06
no of month : 3

then i have to get ending date as 2007-09-06

how??? please help me
May 22 '07 #4

Expert 2.5K+
P: 3,235
You tried my code? It's not working? Perhaps you better post your source code so that we know can see what you are doing wrong.
USE [code] TAGS!
May 22 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.