I know it's a dumb question, but I can't figure it out.
What's wrong with this code? -

$progress_report = curdate();

It doesn't work.

Thank you!

Recommended Answers

try

$progress_report=date();

it will work

Jump to Post

All 7 Replies

try

$progress_report=date();

it will work

Thank you!

Now, this

$progress_report = date("Y-m-d");

works, but when I try to do some date math - like add a month to the current date, it doesn't. I tried these:

$progress_report = strtotime(date("Y-m-d", strtotime($progress_report)) . " +1 month");
$progress_report = mktime(0, 0, 0, date("m")+1, date("d"), date("Y"));
$progress_report= strtotime("+1 month");

All failed.

Never mind, I figured that out.

$time = strtotime("2010-12-11");
$final = date("Y-m-d", strtotime("+1 month", $time)); // to increment 1 month

$time = strtotime("2010-12-11");
$final = date("Y-m-d", strtotime("+1 month", $time));// increment to 1 month

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.