Add month to a date
Hi, i have two related apps and i want to add month to a date.  1ST APP Field 1: execution date   2ND APP Field 1 : @max of execution date Field 2: num of months to added  Field 3: add months FIELD 2 to FIELD 1   Could you suggest what to set in calculated field (FIELD 3)? The formula moment(@max of execution date).add('months',@Num of months to added).format("DD/MM/YYYY") doesn't work, it says invalid date.   Many thanks for the help you give me.  

  • Hi Jenn, this help forum is for Podio calculation fields which use Javascript. Globiflow calculations are completly different, they use PHP. You can't use the scripts from here in a Globiflow calculation. Nevermind: In a flow in Globiflow you can update the date field this way  Action: Update itemyour date field = calc: date("Y-m-d", strtotime([(item) Your Date Field  (Start)]."+ 1 month"))  [(item) Your Date Feild  (Start)] is the token you have to select from the token picker. Helpful examples how to use Globiflow calculations you'll find here Rainer
  • Hi,  I am trying to do something similar and I can't find the answer.  I just want to update a date field to the next month same day using a calculation in globiflow when I update an item. It won't let me use this code. Can anyone help?
  • Many thanks i have used the following: var date = @field 1  // or @max of execution datevar toAdd = @field 2 num of month to addedmoment(date).add(toAdd, 'months').toDate()Very good!!!
  • Hi, the most obvious reason is, that you don't create a date, but a string (text) by using .format()How do you want to show the field 3: the date as a text or like a date field?If you want to show it like a date field: var date = @field 1  // or @max of execution datevar toAdd = @field 2 num of month to addedmoment(date).add(toAdd, 'months').toDate() As text field:  var date = @field 1  // or @max of execution datevar toAdd = @field 2 num of month to addedmoment(date).add(toAdd, 'months').format("DD/MM/YYYY") But we aware: Calculation field can be 3 types: string, number, date. Once a field is saved, the type is fixed, you can't change it, you have to create a new one. Your code above is correct, but it seems, that the field is data type, so it can't show the string you create by using .format(). Other reasons: Is field 2 a number field or a text field? if it's a text field you have to it to a number like: Number(@field 2) or parseInt(@field 2,10).  Is there a value in it? Check if the date in field 1 is correct.  Hope that helps, Rainerrg@delos-consulting.com
This question is closed.