Add 1 month to date

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hardware
    Junior Member
    • May 2023
    • 7

    Add 1 month to date

    Hi all! Tell me how to add date + 1 month to the field1 and display this date in field2.
  • rabii
    Active Community Member
    • Jun 2016
    • 1250

    #2
    you can do it like below:

    PHP Code:
    field2 = datetime\addMonths(field1, 1); 
    

    This will add a 1 month to field1 (which i assume is a date type) and will be stored in field2 which also needs to be date type.

    read more here https://docs.espocrm.com/administrat...mula/datetime/
    Last edited by rabii; 12-11-2023, 12:59 PM.
    Rabii
    Web Dev

    Comment

    • victor
      Active Community Member
      • Aug 2022
      • 728

      #3
      Besides what rabii advised for the second part of your question:
      You can use field with Foreign type https://docs.espocrm.com/administration/fields/#foreign.
      You can use Formula: field2 = field1;
      You can use BPMN or Workflow, specifying the change of the field1 field in the Conditions, and assigning the value of the field1 field to the filed2 field in the Actions.
      Last edited by victor; 12-11-2023, 12:29 PM.

      Comment

      • hardware
        Junior Member
        • May 2023
        • 7

        #4
        Thank you very much everyone, everything worked out!

        Comment

        Working...