Ask AI
Skip to main content

Relative date

Function: Relative date

This action helps you display dates in a more natural, human-friendly way, such as "yesterday," "tomorrow," or "3 days ago," instead of showing a precise date and time. It makes it easier for your users to quickly understand when something happened or will happen.

Input

  • Date to check (DATE): The specific date you want to convert into a relative format. This is a required input.

Output

  • Result (STRING): The relative date expressed as a piece of text (e.g., "yesterday", "tomorrow", "5 days ago").

Execution Flow

Real-Life Examples

Here are some ways you can use the "Relative date" action in your applications:

Example 1: Displaying a recent activity timestamp

Imagine you have a list of user activities and you want to show how long ago each activity occurred.

  • Inputs:
    • Date to check: 2023-10-26 10:30:00 (assuming today's date is 2023-10-27)
  • Result: The action outputs "yesterday". This makes it clear to the user that the activity happened the day before.

Example 2: Showing an upcoming event

You're building an event management app and want to highlight events happening very soon.

  • Inputs:
    • Date to check: 2023-10-28 14:00:00 (assuming today's date is 2023-10-27)
  • Result: The action outputs "tomorrow". This helps users quickly identify events scheduled for the next day.

Example 3: Listing past due tasks

In a task management application, you might want to show how long a task has been overdue.

  • Inputs:
    • Date to check: 2023-10-20 09:00:00 (assuming today's date is 2023-10-27)
  • Result: The action outputs "7 days ago". This provides an immediate understanding of how long the task has been pending.