AutomationFlowsGeneral › Fechas

Fechas

Fechas. Uses executeWorkflowTrigger. Event-driven trigger; 15 nodes.

Event trigger★★★★☆ complexity15 nodesExecute Workflow Trigger
General Trigger: Event Nodes: 15 Complexity: ★★★★☆ Added:

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "Fechas",
  "nodes": [
    {
      "parameters": {
        "options": {}
      },
      "id": "d2e4d79e-cd61-4788-befe-74c3a4511dae",
      "name": "Today",
      "type": "n8n-nodes-base.dateTime",
      "typeVersion": 2,
      "position": [
        580,
        460
      ]
    },
    {
      "parameters": {
        "operation": "addToDate",
        "magnitude": "={{ $json.currentDate }}",
        "duration": "={{ $('Execute Workflow Trigger').item.json.startDay }}",
        "outputFieldName": "setStartDate",
        "options": {}
      },
      "id": "30050688-16c3-4b25-b491-642fbd7a1d51",
      "name": "setStartDate",
      "type": "n8n-nodes-base.dateTime",
      "typeVersion": 2,
      "position": [
        780,
        460
      ]
    },
    {
      "parameters": {
        "operation": "formatDate",
        "date": "={{ $json.setStartDate }}",
        "format": "=yyyyMMdd",
        "outputFieldName": "startDate",
        "options": {}
      },
      "id": "ecc6e306-1977-4284-8715-88dffd51db93",
      "name": "startDate",
      "type": "n8n-nodes-base.dateTime",
      "typeVersion": 2,
      "position": [
        980,
        460
      ]
    },
    {
      "parameters": {
        "operation": "addToDate",
        "magnitude": "={{ $('Today').item.json.currentDate }}",
        "duration": "={{ $('Execute Workflow Trigger').item.json.endDay }}",
        "outputFieldName": "setEndDate",
        "options": {}
      },
      "id": "29681342-2d41-4926-ac41-f8ff6649b1a4",
      "name": "setEndDate",
      "type": "n8n-nodes-base.dateTime",
      "typeVersion": 2,
      "position": [
        780,
        640
      ]
    },
    {
      "parameters": {
        "operation": "formatDate",
        "date": "={{ $json.setEndDate }}",
        "format": "=yyyyMMdd",
        "outputFieldName": "endDate",
        "options": {}
      },
      "id": "136c194b-7348-44ea-925b-c59ccf68daee",
      "name": "endDate",
      "type": "n8n-nodes-base.dateTime",
      "typeVersion": 2,
      "position": [
        980,
        640
      ]
    },
    {
      "parameters": {
        "operation": "addToDate",
        "magnitude": "={{ $('setEndDate').item.json.setEndDate }}",
        "duration": "={{ $('Execute Workflow Trigger').item.json.addDay }}",
        "outputFieldName": "setAddDate",
        "options": {}
      },
      "id": "89da0d68-3be0-4ff2-93c6-d7b693d11b04",
      "name": "setAddDate",
      "type": "n8n-nodes-base.dateTime",
      "typeVersion": 2,
      "position": [
        780,
        820
      ]
    },
    {
      "parameters": {
        "operation": "formatDate",
        "date": "={{ $json.setAddDate }}",
        "format": "=yyyyMMdd",
        "outputFieldName": "addDate",
        "options": {}
      },
      "id": "aa529937-e0e5-42ee-9fd9-944b608e1cd4",
      "name": "addDate",
      "type": "n8n-nodes-base.dateTime",
      "typeVersion": 2,
      "position": [
        980,
        820
      ]
    },
    {
      "parameters": {},
      "id": "89ed436c-158e-4f22-8cf7-8652b78072dd",
      "name": "Execute Workflow Trigger",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "typeVersion": 1,
      "position": [
        380,
        460
      ]
    },
    {
      "parameters": {
        "values": {
          "string": [
            {
              "name": "startDate",
              "value": "={{ $('startDate').item.json.startDate }}"
            },
            {
              "name": "endDate",
              "value": "={{ $('endDate').item.json.endDate }}"
            },
            {
              "name": "addDate",
              "value": "={{ $('addDate').item.json.addDate }}"
            },
            {
              "name": "yearMonth",
              "value": "={{ $('yearMonth').item.json.yearMonth }}"
            },
            {
              "name": "Year",
              "value": "={{ $('Year').item.json.Year }}"
            },
            {
              "name": "yearDays",
              "value": "={{ $json.yearDays }}"
            },
            {
              "name": "startMonthly",
              "value": "={{ $('startMonthly').item.json.startMonthly }}"
            },
            {
              "name": "endMonthly",
              "value": "={{ $('endMonthly').item.json.endMonthly }}"
            },
            {
              "name": "addMonthly",
              "value": "={{ $('addMonthly').item.json.addMonthly }}"
            }
          ]
        },
        "options": {}
      },
      "id": "3f3b596e-1b83-40d2-96aa-67bd0ffd7f71",
      "name": "Dates",
      "type": "n8n-nodes-base.set",
      "position": [
        1180,
        1000
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "operation": "formatDate",
        "date": "={{ $('setStartDate').item.json.setStartDate }}",
        "format": "=yyyyMM",
        "outputFieldName": "yearMonth",
        "options": {}
      },
      "id": "c96a564e-711e-4b02-b97d-1ca81c0fcfbb",
      "name": "yearMonth",
      "type": "n8n-nodes-base.dateTime",
      "typeVersion": 2,
      "position": [
        580,
        1000
      ]
    },
    {
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "// Para procesar UN item\nconst fecha1 = new Date($('Year').first().json.Year + '-01-01');\nconst fecha2 = new Date($('Today').first().json.currentDate);\n\nconst yearDays = Math.floor((fecha2 - fecha1) / (1000 * 60 * 60 * 24));\n\nreturn {\n  json: {\n    yearDays: yearDays\n  }\n};"
      },
      "id": "44fe8391-b20b-484b-abf4-22528a0a8f0c",
      "name": "yearDays",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        980,
        1000
      ]
    },
    {
      "parameters": {
        "operation": "formatDate",
        "date": "={{ $('setStartDate').item.json.setStartDate }}",
        "format": "=yyyy",
        "outputFieldName": "Year",
        "options": {}
      },
      "id": "ab60b28e-ab1f-431e-987d-e807eac7077e",
      "name": "Year",
      "type": "n8n-nodes-base.dateTime",
      "typeVersion": 2,
      "position": [
        780,
        1000
      ]
    },
    {
      "parameters": {
        "operation": "formatDate",
        "date": "={{ new Date(new Date($('setStartDate').item.json.setStartDate).getFullYear(), new Date($('setStartDate').item.json.setStartDate).getMonth(), 1) }}",
        "format": "=yyyyMMdd",
        "outputFieldName": "startMonthly",
        "options": {}
      },
      "id": "79ad83be-febe-476f-9034-9a935def8a16",
      "name": "startMonthly",
      "type": "n8n-nodes-base.dateTime",
      "typeVersion": 2,
      "position": [
        1180,
        460
      ]
    },
    {
      "parameters": {
        "operation": "formatDate",
        "date": "={{ new Date(new Date($('setEndDate').item.json.setEndDate).getFullYear(), new Date($('setEndDate').item.json.setEndDate).getMonth() + 1, 0) }}",
        "format": "=yyyyMMdd",
        "outputFieldName": "endMonthly",
        "options": {}
      },
      "id": "5f2a173c-63b5-4794-8ba2-7b86b0578933",
      "name": "endMonthly",
      "type": "n8n-nodes-base.dateTime",
      "typeVersion": 2,
      "position": [
        1180,
        640
      ]
    },
    {
      "parameters": {
        "operation": "formatDate",
        "date": "={{ new Date(new Date($('setEndDate').item.json.setEndDate).getFullYear(), new Date($('setEndDate').item.json.setEndDate).getMonth() + 1, 1) }}",
        "format": "=yyyyMMdd",
        "outputFieldName": "addMonthly",
        "options": {}
      },
      "id": "7f0e34f9-d62d-4f30-b3e4-9b284bee0aed",
      "name": "addMonthly",
      "type": "n8n-nodes-base.dateTime",
      "typeVersion": 2,
      "position": [
        1180,
        820
      ]
    }
  ],
  "connections": {
    "Today": {
      "main": [
        [
          {
            "node": "setStartDate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "setStartDate": {
      "main": [
        [
          {
            "node": "startDate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "startDate": {
      "main": [
        [
          {
            "node": "startMonthly",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "setEndDate": {
      "main": [
        [
          {
            "node": "endDate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "endDate": {
      "main": [
        [
          {
            "node": "endMonthly",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "setAddDate": {
      "main": [
        [
          {
            "node": "addDate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "addDate": {
      "main": [
        [
          {
            "node": "addMonthly",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute Workflow Trigger": {
      "main": [
        [
          {
            "node": "Today",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "yearMonth": {
      "main": [
        [
          {
            "node": "Year",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "yearDays": {
      "main": [
        [
          {
            "node": "Dates",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Year": {
      "main": [
        [
          {
            "node": "yearDays",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "startMonthly": {
      "main": [
        [
          {
            "node": "setEndDate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "endMonthly": {
      "main": [
        [
          {
            "node": "setAddDate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "addMonthly": {
      "main": [
        [
          {
            "node": "yearMonth",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "timezone": "America/Bogota",
    "callerPolicy": "workflowsFromSameOwner"
  },
  "versionId": "122c892a-7338-463a-b318-f59137b48f1e",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "08k9xdf0VByNBZM2",
  "tags": []
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Fechas. Uses executeWorkflowTrigger. Event-driven trigger; 15 nodes.

Source: https://github.com/alfarodaniel/ETL-Ambulatorios/blob/b5caacf5509134abba40f7a402e60f1f24b151d8/n8n/Fechas.json — original creator credit. Request a take-down →

More General workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

General

Reagendamiento. Uses executeWorkflowTrigger, redis, n8n-nodes-evolution-api, dataTable. Event-driven trigger; 73 nodes.

Execute Workflow Trigger, Redis, N8N Nodes Evolution Api +2
General

Agendamiento. Uses n8n-nodes-evolution-api, redis, dataTable, executeWorkflowTrigger. Event-driven trigger; 60 nodes.

N8N Nodes Evolution Api, Redis, Data Table +2
General

Prevent concurrent workflow runs using Redis. Uses executeWorkflowTrigger, manualTrigger, stickyNote, executeWorkflow. Event-driven trigger; 43 nodes.

Execute Workflow Trigger, Redis, Stop And Error
General

This workflow sets a small "lock" value in Redis so that only one copy of a long job can run at the same time. If another trigger fires while the job is still busy, the workflow sees the lock, stops e

Execute Workflow Trigger, Redis, Stop And Error
General

Reputation Engine — Site Refresh. Uses httpRequest, executeWorkflowTrigger. Event-driven trigger; 35 nodes.

HTTP Request, Execute Workflow Trigger