Today

returns the current date

The Today() function in Power FX returns the current date without the time component. It’s useful for comparing dates, setting deadlines, calculating durations, or triggering actions based on today’s date.

Syntax

the basic syntax is

Today()

Since the format of DateTime data of the Alloy table is ISO 8601 formatted, while the Date Time data as the result of the syntax Today() is not, you will need to:

  • convert the DateTime data of the Alloy table if you want to subtract the difference between it with Today()

DateDiff(DateValue(ThisItem.DateTimeColumn),Today(),TimeUnit[Unit]
or
DateDiff(DateTimeValue(ThisItem.DateTimeColumn),Today(),TimeUnit[Unit]
  • convert the Date Time data with is the result of the syntax Today()to ISO 8601 format for the data representation in the app.

Text(Today(),"yyyy-MM-dd")
or
Text(Today(),"yyyy-MM-dd hh:mm:ss")

Examples

Below are some examples for practical usages with syntax Today():

SyntaxDescription

DateDiff(Today(), DateValue(ThisItem.Deadline), TimeUnit.Days)

calculates the difference in days between today’s date and the deadline.

If(DateValue(ThisItem.Deadline) = Today(), "Due Today", "Upcoming")

checks if the task deadline is today and returns "Due Today" if true.

If(ThisItem.Status <> "Completed" && DateValue(ThisItem.Deadline) < Today(), "Overdue", "")

add an "Overdue" status when the task's deadline has passed, and the task is not completed.

Limitations

Today() do not include the time component.

If you need the current time as well, use the Now() function, which returns both date and time.

Last updated