Skip to Content Skip to Menu

[SOLVED] Substitution: How to calculate Today date + Days = Future date

  • dotcom22
  • dotcom22
  • OFFLINE
  • Posts: 522
  • Thanks: 14
  • Karma: 4
10 years 5 months ago - 10 years 5 months ago #245720 by dotcom22
When using [cb:date format="d-m-Y" /] this allow to display the current date. Now I would like add to this "Today date" a specific number of days coming from the value of a specific field [cb_validity].

My goal would be to place inside a delimiter [cb:date format="d-m-Y" /] + [cb_validity] for output the result. So in practice if [cb_validity] is equal to 10 and today we are the 5.6.2014, the result must be 15.6.2014.

How to do this ?
thank

I use Joomla 3.3.6 - CB 2.0.4 - CBSubs 4 - Several Incubator plugins
Last edit: 10 years 5 months ago by krileon.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48482
  • Thanks: 8283
  • Karma: 1443
10 years 5 months ago #245745 by krileon
Substitutions do not have any math functionality. It's not possible to do that with substitutions. You'd need to compute the date using CB Query Field for example and format it using SQL date format functions.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

  • dotcom22
  • dotcom22
  • OFFLINE
  • Posts: 522
  • Thanks: 14
  • Karma: 4
10 years 5 months ago #245755 by dotcom22
Ok you right, I solved the problem with this query:

SELECT DATE_FORMAT(DATE_ADD(now(), INTERVAL cb_field DAY), '%d.%m.%Y' ) FROM `jos_comprofiler` WHERE `user_id` = '[user_id]';


cheers

I use Joomla 3.3.6 - CB 2.0.4 - CBSubs 4 - Several Incubator plugins

Please Log in or Create an account to join the conversation.

  • lkessner
  • lkessner
  • OFFLINE
  • Posts: 15
  • Thanks: 1
  • Karma: 0
10 years 2 months ago - 10 years 2 months ago #248043 by lkessner
Hi,

it is an possibility to use like this: strtotime('[cb_userdate] + 1 days')?
It looks like strtotime have math function.

Greets

Lars
Last edit: 10 years 2 months ago by lkessner.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48482
  • Thanks: 8283
  • Karma: 1443
10 years 2 months ago #248061 by krileon
Not currently, but it's planned for next CB Auto Actions release after CB 2.0 goes Stable.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

  • dotcom22
  • dotcom22
  • OFFLINE
  • Posts: 522
  • Thanks: 14
  • Karma: 4
9 years 10 months ago #255599 by dotcom22

krileon wrote: Not currently, but it's planned for next CB Auto Actions release after CB 2.0 goes Stable.



Could you tell me if now Auto-Action allow to calculate date? It seem you have implemented strtotime but maybe not usable as a substitution. If yes I don't see how to format the value.

My goal would be to set a field with [today date] + [30 days] without using query field for make calculation.

I use Joomla 3.3.6 - CB 2.0.4 - CBSubs 4 - Several Incubator plugins

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum