ChronoEngine.com homepage

Forums

Please write a review for the extension you are using on the Joomla extensions directory before posting a new question as we are being spammed by many negative reviews.

Thank you for your support!

How to adjust time using a php function?

cyberspyder 25 Jul, 2020
I am trying to use the built in date function (created time) for my "from" date and I need to add one year to be a "to" date.

Here is the code in my PHP block:
$date = $this->date;
$validUntil = date('Y-m-d H:i:s', strtotime($date. ' + 1 year'));
return $validUntil;

Then in my Save function here is my code: {var:php43.validUntil}

I am assuming my PHP knowledge is lacking and my code has an error because the value I get when I try to save it is null.
Max_admin 25 Jul, 2020
you should call this with {var:php43} only, the value of this is the return value, your current code would work if you return an array ["validUntil" => 123]
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
healyhatman 26 Jul, 2020
{date:Y-m-d $(data:form_field_name) + 1 year}
This topic is locked and no more replies can be posted.

2Checkout.com

2CheckOut.com Inc. (Ohio, USA) is an authorized retailer for goods and services provided by ChronoEngine.com