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!
try
$progress_report=date();
it will work
curdate(); is a mysql's function .
Read the links
http://www.tizag.com/mysqlTutorial/mysql-date.php
http://www.smallsql.de/doc/sql-functions/date-time/curdate.html
And http://php.net/manual/en/function.date.php
or simple method
$progress_report = date("Y-m-d");
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
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.