didier1 Posted December 17, 2017 Share Posted December 17, 2017 Hello, I'm trying to build an email template that will use a custom field date that is already created with this format (DD/MM/YY) and will add 1 day or 1 month depending of our needs as follow. We are working on something like that but need help for the syntax {$service_custom_fields.0 + 1 } ( will give 31 on a custom field value of 30/06/2018 - we are expecting 01/07/2018 Do we need to convert that value into number and than add +1 than reconverting ? many thanks again guys Link to comment Share on other sites More sharing options...
brian! Posted December 17, 2017 Share Posted December 17, 2017 if this is a recent version of WHMCS, you should be able to use... {"$service_custom_fields.0 +1 Day"|date_format:'d/m/Y'} if it's an older version, then you may need to use strtotime. Link to comment Share on other sites More sharing options...
didier1 Posted December 18, 2017 Author Share Posted December 18, 2017 Hello Brian, some how when I use 19 hours ago, brian! said: {"$service_custom_fields.0 +1 Day"|date_format:'d/m/Y'} it give me today's datre - Note that my custom field value is a text box : 30/06/2018 - The expected result is 01/07/2018. I have the same result with or without the '+1 day' Somehow the date format that we are trying to specify reverts the custom field to today's date without considering our teh + 1 day we would like to use I'm using WHMCS V7.4.1 thank you in advanced Link to comment Share on other sites More sharing options...
brian! Posted December 18, 2017 Share Posted December 18, 2017 ah ok, it's not liking the date format of the custom field... I should have remembered what I posted in the thread below... i'll blame it on the time of year and my head being elsewhere! {$service_custom_fields.0|replace:'/':'-'|cat:' +1 day'|date_format:'%d/%m/%Y'} for me, this is working in v7.4.1 in an email template - the image below shows {$service_custom_fields.0} and the above code... if you want to add 1 month, then just change +1 day to +1 month in the code... if it's more than one day, use days; similarly for weeks, months, years etc. Link to comment Share on other sites More sharing options...
didier1 Posted December 18, 2017 Author Share Posted December 18, 2017 It worked perfectly ! thanks again Brian. Have a good holidays season. Link to comment Share on other sites More sharing options...
Recommended Posts