Get today's date and day using the Function node

For platform n8n, this workflow retrieves today's date and the corresponding day of the week upon manual execution, providing users with quick access to current date information for scheduling and planning purposes.

7/8/2025
2 nodes
Medium
manualmediumcodecustom
Categories:
Manual TriggeredMedium Workflow

Target Audience

This workflow is ideal for:
- Developers looking to automate date and day retrieval in applications.
- Project Managers who need to keep track of daily tasks and deadlines.
- Data Analysts who require date information for reporting and analytics.
- Anyone needing quick access to today's date and day for personal or professional use.

Problem Solved

This workflow addresses the need for quick and automated retrieval of today's date and the corresponding day of the week. It eliminates the need for manual date entry, reducing errors and saving time, especially in workflows that depend on current date information.

Workflow Steps

  • Manual Trigger: The workflow starts when the user clicks the 'execute' button, initiating the process.
    2. Function Node: The Function node executes JavaScript code that:
    - Retrieves the current date in ISO format.
    - Determines the current day of the week (0 for Sunday through 6 for Saturday).
    - Maps the day number to the corresponding weekday name using an array.
    3. Output: The workflow returns an object containing:
    - date_today: Current date in ISO format.
    - day_today: Name of the current weekday.
  • Customization Guide

    Users can customize this workflow by:
    - Modifying the output format of the date (e.g., changing to a different format like MM/DD/YYYY).
    - Adding additional functionality to retrieve more date-related information (e.g., week number, month name).
    - Integrating this workflow with other nodes to perform actions based on the retrieved date and day (e.g., sending reminders or notifications).