PHP help with Script - display the Year only

Status
Not open for further replies.

stevelis

Member
The script below is part of a php file that is used in a Fabrik schedule plugin which is working fine with the year (2019) typed as plain text.
Can anybody assist with the code/function I should use that will automatically change the year, rather than open the file manually and change the text to the following year.
BTW the startDate and endDate only displays the day and month

<b>Hi {$steward->FName},</b>
<br>Your next stewarding event is {$row->calendar___Event} at {$row->calendar___Location}
<br>Commencing on {$startDate} and finishing on {$endDate} 2019
<br>
 
PHP:
$d=strtotime("+1 Year");

<b>Hi {$steward->FName},</b>
<br>Your next stewarding event is {$row->calendar___Event} at {$row->calendar___Location}
<br>Commencing on {$startDate} and finishing on {$endDate} {date("Y", $d)}
<br>
 
Thanks Start Online and will try
If I wanted the current year, I am assuming it would look like $d=strtotime(" Year");
Then on the 1st Jan each year it would update itself to the current year
Steve
 
Hey Steve,

Ping me on Skype if you need more help. I think I still owe you some work on the steward emails?

-- hugh
 
Hi startpoint
Had to go interstate for a couple days hence, a slower than normal response of thanks.
Your reply certainly pointed me in the right direction and got the thought processes going, as I couldn't get your code to function as required.
PHP 7.2 accepted $d = date("Y"); instead of strtotime which yielded the correct year and format, 2019
Then I just played around with {date("Y", $d)} until it worked with $d
<br>Commencing on {$startDate} and finishing on {$endDate} $d;
Commencing on Sunday 21st July and finishing on Sunday 21st July 2019
Thanks again startpoint for your assistance. :)
Steve
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top