# Today, Now, Day, Month, Year, Hour, Minute and Second functions in Power Apps

## 1. Today Function in Power Apps

The **Today** function returns the current date as a date/time value. The time portion is midnight. Today has the same value throughout a day, from midnight today to midnight tomorrow.

Power Apps Syntax

Example: Suppose the todays date in this example is 4th April 2023.

We can add number of days to the current date.

We can also subtract the number of days from the current date.

## 2. Now Function in Power Apps

The Now function returns the current date and time as a date/time value.

Power Apps Syntax

Example: The current date and time value is April 21, 2023 and 09:26 PM.

Let’s add Text label control and set the Text property of the label control to the following powerapps formula.

Power Apps Formula

## 3. IsToday Function in Power Apps

The **IsToday** function tests whether a date/time value is between midnight today and midnight tomorrow. This function returns a Boolean i.e., true or false value.

Power Apps Syntax IsToday(DateTime)

• DateTime - Required. The date/time value to test.

## 4. Day Function in Power Apps

The Day function returns the day component of a Date/Time value, ranging from 1 to 31.

Power Apps Syntax Day(DateTime)

• DateTime - Required. Date/Time value to operate on.

Example: For the following example, the current date and time are April 21, 2023 and 09:42:44 PM.

Power Apps Formula

## 5. Month function in Power Apps

The Month power apps function returns the month component of a Date/Time value, ranging from 1 to 12.

Power Apps Syntax Month(DateTime)

The function has the following parameter:

• DateTime - Required. Date/Time value to operate on.

Example: The following is an example, where the current date is 21/04/2023.

Power Apps Formula

## 6. Year function in Power Apps

The Year function returns the year component of a Date/Time value, starting with 1900.

Power Apps Syntax Year( DateTime )

• DateTime - Required. Date/Time value to operate on.

Example: The current date and time value is April 21, 2023 and 09:26 PM.

## 7. DateAdd Function in Power Apps

The DateAdd function adds a number of units to a date/time value. The result is a new date/time value. We can also subtract a number of units from a date/time value by specifying a negative value.

## 8. DateDiff Function in Power Apps

The DateDiff function returns the difference between two date/time values. The result is a whole number of units.

Power Apps Syntax DateDiff(StartDateTime, EndDateTime [, Units ] )

The function has the following parameters:

- StartDateTime - Required. Starting date/time value.
- EndDateTime - Required. Ending date/time value.
- Units - Optional. The type of Units to subtract: TimeUnit.Milliseconds, TimeUnit.Seconds, TimeUnit.Minutes, TimeUnit.Hours, TimeUnit.Days, TimeUnit.Months, TimeUnit.Quarters, or TimeUnit.Years. If not specified, TimeUnit.Days are used.

Example: In all these examples, assume that the current date and time is April 21, 2023, 11:58 PM.

a) The following formula returns the difference between the two units in the default units of TimeUnit.Days

Power Apps Formula

The returned value can be positive and negative depends on the start date and end date.

Power Apps Formula

b) The following formula returns the difference between the two values in TimeUnit.Months

Power Apps Formula

c) The following formula returns the difference between the current date/time and the current date and today function always returns time 12:00:00 AM. Since the Now is later than Today, the result will be negative.

Power Apps Formula

## 9. Hour Function in Power Apps

The Hour, Minute and Second function returns individual components of a Date/Time value. These functions return a number.

The Hour function returns the hour component of a Date/Time value, ranging from 0 (12:00 AM) to 23 (11:00 PM).

Power Apps Syntax Hour(DateTime)

Example: The following formula returns the hour component of current time and date. The current date and time are April 21, 2023 and 09:42:44 PM.

Power Apps Formula

## 10. Minute

The Minute powerapps function returns the minute component of a Date/Time value, ranging from 0 to 59.

Power Apps Syntax Minute(DateTime)

Example: The following formula returns the minute component of the current time and date. The current date and time are April 21, 2023 and 09:42:44 PM.

Power Apps Formula

## 11. Second() Function in Power Apps

The Second powerapps function returns the second component of a Date/Time value, ranging from 0 to 59.

Power Apps Syntax Second( DateTime )

• DateTime - Required. Date/Time value to operate on.

Example: The following formula returns the second component of the current time and date. The current date and time are April 21, 2023 and 09:42:44 PM.

Power Apps Formula