good day.!

I want this date format to be echo. 2009-2010. My code gots error when i try to show this format. Here is my code:

$nowdate = date('Y') "-" date('Y') + 1;
echo $nowdate;

Thank you for giving time this simple problem.

God bless on this mother earth.

I assume you want $nowdate to be a string. String concatenation in PHP uses a period character to join strings. This **should** work:

$nowdate = date('Y') . "-" . (date('Y') + 1);
Comments
useful

This may not be the best way to do it, but it should work

$thisYear = date('Y');
$nextYear = $thisYear + 1
$nowdate = $thisYear "-" $nextYear;

I really need to go to sleep :D

This may not be the best way to do it, but it should work

$thisYear = date('Y');
$nextYear = $thisYear + 1
$nowdate = $thisYear "-" $nextYear;

I really need to go to sleep :D

Ive just made a little adjustment of the code you've given and it works. below is the code:

$thisYear = date('Y');
$nextYear = $thisYear + 1;
$nowdate = $thisYear ."-". $nextYear;
echo $nowdate;

Thank many very much.

The first reply shows nothing on the browser but I use his technique to concantinate the string and echo it.

Thank you to all.

This question has already been answered. Start a new discussion instead.