All Power Apps Date & Time Functions (With Examples) (2024)

Working with dates & times is one of the biggest challenges in Power Apps. Dealing with date formats, time-zones and date manipulation is even hard for experienced Power Apps developers. In this article I will list all of the Power Apps date & time functions and show examples of how to use them.

Table Of Contents:Current Date & TimeTODAY FunctionNOW FunctionType Conversion FunctionsDATE FunctionTIME FunctionDATEVALUE FunctionTIMEVALUE FunctionDATETIMEVALUE FunctionTEXT FunctionDate & Time Manipulation FunctionsDATEADD FunctionDATEDIFF FunctionEDATE FunctionEOMONTH FunctionTIMEZONEOFFSET FunctionDate & Time Parsing FunctionsYEAR FunctionMONTH FunctionDAY FunctionWEEKDAY FunctionWEEKNUM FunctionISOWEEKNUM FunctionHOUR FunctionMINUTE FunctionSECOND FunctionLogical FunctionsISTODAY FunctionDate & Time Information FunctionsCALENDAR FunctionCLOCK Function


Current Date & Time Functions

Today Function

All Power Apps Date & Time Functions (With Examples) (1)

Purpose
Returns the current date

Syntax

Today()

Example
Assume the current date & time is January 15, 2021 5:00:00 PM.

Today() // Result: January 15, 2021

Now Function

All Power Apps Date & Time Functions (With Examples) (2)

Purpose
Returns the current date and time

Syntax

Now()

Example
Assume the current date & time is January 15, 2021 5:00:00 PM.

Now() // Result: January 15, 2021 5:00 PM

Type Conversion Functions

Date Function

All Power Apps Date & Time Functions (With Examples) (3)

Purpose
Creates a date from a year, month and day

Syntax

Date(year, month, day)

Arguments

year – number for the year

month – number for the month (January is 1, February is 2, March is 3… December is 12)

day – number for the day

Examples

Date(2021, 1, 15) // Result: January 15, 2021Date(2021, 9, 4) // Result: September 4, 2021Date(2018, 3, 11) // Result: March 11, 2018

Time Function

All Power Apps Date & Time Functions (With Examples) (4)

Purpose
Creates a time from hours, minutes and seconds

Syntax

Time(hours, minutes, second)

Arguments

hour – number for the hour (12AM is 0, 1AM is 1, 2AM is 2… 11PM is 23)

minute – number for the minute

second – number for the second

Examples

Time(2, 30, 0) // Result: 2:30 AMTime(14, 30, 0) // Result: 2:30 PMTime(19, 15, 10) // Result: 7:15:10 PM

A Date & Time can be combined into a single DateTime value like this:

Date(2021, 1, 20) + Time(14, 30, 0) // Result: January 20, 2021, 2:30 PM

DateValue Function

All Power Apps Date & Time Functions (With Examples) (5)

Purpose
Converts a date stored as text into a date data-type

Syntax

DateValue(string [,language])

Arguments

string – text string containing a date

DateValue("January 15, 2021") // Result: January 15, 2021 DateValue("01/15/2021") // Result: January 15, 2021

TimeValue Function

All Power Apps Date & Time Functions (With Examples) (6)

Purpose
Converts a time stored as text into a time data-type

Syntax

TimeValue(string [,language])

Arguments

string – text string containing a time

language [optional] – two letter language code, defaults to current user’s language

Examples

TimeValue("2:00 PM") // Result: 2:00 AMTimeValue("17:00") // Result: 2:00 PM

DateTimeValue Function

All Power Apps Date & Time Functions (With Examples) (7)

Purpose
Converts a date & time stored as text into a time data-type

Syntax

DateTimeValue(string [,language])

Arguments

string – text string containing a datetime

language [optional] – two letter language code, defaults to current user’s language

Example

DateTimeValue("October 11, 2014 1:50:24 PM") // Result: October 11, 201 1:50:24 PM

Text Function

All Power Apps Date & Time Functions (With Examples) (8)

Purpose
Applies a date format and changes the data-type to text

Syntax #1

Text(NumberOrDateTime, DateTimeFormatEnum [, ResultLanguageTag])

Arguments

NumberOrDateTime – text string containing a datetime

DateTimeFormatEnum – value belonging to the DateTimeFormat enum. See list below.

ResultLanguageTag [optional] – two letter language code, defaults to current user’s language

Example
Assume the current date & time is January 15, 2021 5:00:00 PM.

Text(Today(), "m/d/yyyy") // Result: "1/15/2021"

Syntax #2

Text( NumberOrDateTime, CustomFormat [, ResultLanguageTag ] )

Arguments

NumberOrDateTime – text string containing a datetime

Custom Format – text string with date formatting code. See list below.

ResultLanguageTag [optional] – two letter language code, defaults to current user’s language

Example
Assume the current date & time is January 15, 2021 5:00:00 PM

Text(Today(), "m/d/yyyy") // Result: "1/15/2021"

Syntax #3

Text(NumberOrDateTime)

Arguments

NumberOrDateTime – text string containing a datetime

Example
Assume the current date & time is January 15, 2021 5:00:00 PM.

Text(Today()) // Result: "1/15/2021"

Date and Time Formatting Codes
Use these formatting codes in the 2nd parameter of the Text function.

Enum FormatText FormatResult
LongDate“dddd, mmmm d, yyyy”“Friday, January 15, 2021”
LongDateTime“dddd, mmmm d, yyyy hh:mm:ss AM/PM”“Friday, January 15, 2021 5:00:00 PM”
LongDateTime24“dddd, mmmm d, yyyy hh:mm:ss”“Friday, January 15, 2021 17:00:00”
LongTime“hh:mm:ss AM/PM”“5:00:00 PM”
LongTime24“hh:mm:ss”“17:00:00”
ShortDate“m/d/yyyy”“1/15/2021”
ShortDateTime“m/d/yyyy hh:mm AM/PM”“1/15/2021 5:00 PM”
ShortDateTime24“m/d/yyyy hh:mm”“1/15/2021 17:00:00”
ShortTime“hh:mm AM/PM”“5:00 PM”
ShortTime24“hh:mm”“17:00”
UTC“2021-01-15T23:00:00.000Z”

Date & Time Manipulation Functions

DateAdd Function

All Power Apps Date & Time Functions (With Examples) (9)

Purpose
Adds a number or days to a date & time value. Can also add another time unit such as hours or months. If a negative number is supplied the number of time units will be subtracted.

Syntax

DateAdd(DateTime, Addition [, Units])

Arguments

DateTime – date and time value

Addition – number of days or other time units to add to the DateTime

Units [optional] – one of the following enum values: Years, Quarters, Months, Days, Hours, Minutes, Seconds or Milleseconds. Default units are days.

Examples
Assume the current date & time is January 15, 2021 5:00:00 PM.

DateAdd(Today(), 7) // Result: January 22, 2021DateAdd(Today(), 2, Months) // Result: March 15, 2021DateAdd(Today(), -1, Years) // Result: January 15, 2020

DateDiff Function

All Power Apps Date & Time Functions (With Examples) (10)

Purpose
Finds the a number or days between a start date and an end date. Can also add another time unit (e.g. hours, months)

Syntax

DateDiff(StartDateTime, EndDateTime [, Units])

Arguments

StartDateTime – starting date and time value

EndDateTime – ending date and time value

Units [optional] – one of the following enum values: Years, Quarters, Months, Days, Hours, Minutes, Seconds orMilleseconds. Default units are days.

Examples
Assume the current date & time is January 15, 2021 5:00:00 PM.

DateDiff(Today(), Date(2021, 01, 20), Days) // Result: 5 daysDateDiff(Date(2021, 01, 15)+Time(9, 0, 0), Today(), Hours) // Result: 8 hours

EDate Function

All Power Apps Date & Time Functions (With Examples) (11)

Purpose
Adds a given number of months to a date. The day number remains the same unless the new value is beyond the end of the month.

Syntax

EDate(StartDateTime, EndDateTime [, Units])

Arguments

Date – starting date and time value

Months – months to add or subtract from the date.

Examples
Assumes the current date is June 15, 2023.

EDate(Today(), 4) // Result: October 15, 2023EDate(Today(), -2) // Result: April 15, 2023EDate(Date(2023, 05, 31), 1) // Result: June 30, 2023

EOMonth Function

All Power Apps Date & Time Functions (With Examples) (12)

Purpose
Returns the last day of the month for a given date.

Syntax

EOMonth(Date [, Months])

Arguments

Date – starting date and time value

Months [optional] – ending date and time value

Examples
Assume the current date is January 1, 2024.

EOMonth(Today()) // Result: January 31, 2024EOMonth(Today(), 2) // Result: March 31, 2024EOMonth(Today(), -1) // Result: December 31, 2023

TimeZoneOffset Function

All Power Apps Date & Time Functions (With Examples) (13)

Purpose
Returns the number of minutes between the user’s local time and Universal Co-ordinated Time (UTC)

Syntax

TimeZoneOffset()

Examples
Converts the user’s local time to UTC. Assume the user’s local current date & time is January 15, 2021 5:00:00 PM

DateAdd( Now(), TimeZoneOffset(), Minutes) // Result: January 15, 11:00PM

Converts UTC to the user’s local time. Assume the current UTC date & time is January 15, 2021 11:00:00 PM

DateAdd( StartTime, −TimeZoneOffset(StartTime), Minutes)// Result: January 15, 5:00PM

Date & Time Parsing Functions

Year Function, Month Function, Day Function, WeekNum Function, ISOWeekNum Function, Hour Function, Minute Function, Second Function

All Power Apps Date & Time Functions (With Examples) (14)

Purpose
Extracts an single part of the date & time value

Syntax

Year()

Month()

Day()

Weekday()

WeekNum()

ISOWeekNumber()

Hour()

Minute()

Second()

Examples
Assume the current date & time is January 15, 2021 5:00:00 PM.

Year(Now()) // Result: 2021Month(Now()) // Result: 1Day(Now()) // Result: 15Weekday(Now()) // Result: 3WeekNum(Now()) // Result: 3ISOWeekNum(Now()) // Result: 2Hour(Now()) // Result: 17Minute(Now()) // Result: 0Second(Now()) // Result: 0

Logical Functions

IsToday Function

All Power Apps Date & Time Functions (With Examples) (15)

Purpose
Checks whether a date & time value is within the current day and returns a true/false value.

Syntax

IsToday(DateTime)

Arguments

DateTime – a date & time value to compare

Examples
Assume the user’s local current date & time is January 15, 2021 5:00:00 PM.

IsToday(Date(2021, 1, 15) // Result: trueIsToday(Date(2021, 1, 22) // Result: false

Date & Time Information Functions


Calendar Function
All Power Apps Date & Time Functions (With Examples) (16)

Purpose
Returns calendar information for the user’s current locale.

Syntax

Calendar.MonthsLong()

Calendar.MonthsShort()

Calendar.WeekdaysLong()

Calendar.WeekdaysShort()

Examples

FormulaResult
Calendar.MonthsLong()[ “January”, “February”, “March”, “April”, “May”, “June”, “July”, “August”, “September”, “October”, “November”, “December” ]
Calendar.MonthsShort()[ “Jan”, “Feb”, “Mar”, “Apr”, “May”, “Jun”, “Jul”, “Aug”, “Sep”, “Oct”, “Nov”, “Dec” ]
Calendar.WeekdaysLong()[ “Sunday”, “Monday”, “Tuesday”, “Wednesday”, “Thursday”, “Friday”, “Saturday” ]
Calendar.WeekdaysShort()[ “Sun”, “Mon”, “Tue”, “Wed”, “Thu”, “Fri”, “Sat” ]

Clock Function

All Power Apps Date & Time Functions (With Examples) (17)

Purpose
Returns clock information for the user’s current locale.

Syntax

Clock.AmPm()

Clock.AmPmShort()

Clock.IsClock24()

Examples

FormulaResult
Clock.AmPm()[ “AM”, “PM” ]
Clock.AmPmShort()[ “A”, “P” ]
Clock.IsClock24()FALSE

Did You Enjoy This Article? 😺

Subscribe to get new Power Apps articles sent to your inbox each week for FREE

Questions?

If you have any questions or feedback about All Power Apps Date & Time Functions (With Examples) please leave a message in the comments section below. You can post using your email address and are not required to create an account to join the discussion.

All Power Apps Date & Time Functions (With Examples) (2024)

FAQs

What is the format for date and time in Power Apps? ›

Format dates and times by using DateTimeValue

Specify the format by using built-in and custom options. The DateTimeValue and DateValue functions can convert dates in any of these formats into values: MM/DD/YYYY. DD/MM/YYYY.

What is the datetime function in power app? ›

The DateTime function combines the Date and Time functions into a single function, taking both date and time arguments and returning a Date/Time value that has both date and time components. See the DateValue, TimeValue, and DateTimeValue functions for information about how to convert a string to a value.

What is the example of date and time function? ›

For example, DATETIME(n,n,n ,27,0,0) returns the time as. 125 or 3:00 AM. Minute is a number from 0 to 32767 representing the minute.

How to combine date and time in Power Apps? ›

You don't need the DateTimeValue in your expression - adding a date and a time value already return a date/time value. The DateTimeValue function converts a text to a date/time, so what it is doing is (implicitly) converting your date/time to a text, then converting it back to a date/time value.

How do I use date time picker in Power Apps? ›

How To Setup The Power Apps Date Picke Control
  1. Select the date picker control in Power Apps studio. Set the Default property value to define the date picker's initial state. ...
  2. Click on the date picker control to open the calendar. Select a date from the calendar.
  3. Get the date picker's current value by using this code.

What is the 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. You can also subtract a number of units from a date/time value by specifying a negative value. The DateDiff function returns the difference between two date/time values.

What is the duration function in Powerapps? ›

The “Timer” function in Power Apps analyses how your software performs after a predetermined amount of time. Its duration property defines the length of time in milliseconds that the PowerApps timer will operate. The default duration is 60 seconds, while the maximum duration is 24 hours.

What is date time example format? ›

dd/MM/yyyy — Example: 23/06/2013. yyyy/M/d — Example: 2013/6/23. yyyy-MM-dd — Example: 2013-06-23. yyyyMMddTHH:mmzzz — Example: 20130623T13:22-0500.

What is the formula of date and time? ›

Excel current date and time example

NOTE: Excel uses a 24-hour clock when it outputs the time. As you can see, the =TODAY() formula only includes the day, month and year. The =NOW() function displays more information, showing the day, month, year, hour and minutes (using a 24-hour clock).

What is the format for TIMESTAMP? ›

Timestamp values are accepted in the format 'yyyy‑MM‑dd HH:mm:ss. SSSSSS' , and can consist of just the date, or just the time, with or without the fractional second portion. For example, you can specify TIMESTAMP values such as '1966‑07‑30' , '08:30:00' , or '1985‑09‑25 17:45:30.005' .

What is the format for date and time in Powerapps? ›

Dates must be in one of these formats: MM/DD/YYYY or MM-DD-YYYY. DD/MM/YYYY or DD-MM-YYYY. YYYY/MM/DD or YYYY-MM-DD.

What is the date function in power apps? ›

Date & Time Functions
CalendarRetrieves information about the calendar for the current locale.
DateReturns a date/time value, based on Year, Month,and Day values.
DateAddAdds days, months, quarters, or years to a date/time value.
DateDiffSubtracts two date values, and shows the result in days, months,quarters, or years.
21 more rows

What is the date format for power apps portals? ›

Portals: Changing the Date from the Default Format
  • Navigate to Portals in the dashboard.
  • Click on Site Settings.
  • Browse through the Site Setting records to check if you can find a record with “DateTime/DateFormat” in the Name field. ...
  • Open the record and edit the Value field to the desired date format string. ...
  • Click Save.

What is the format of date in power flow? ›

MM/DD/YYYY Format

Create a new flow in Power Automate. Add the “Initialize Variable” action to store the formatted date in the desired format. Add the “Compose” action to manipulate the date format. Add the “FormatDateTime” function and specify the input date and the desired MM/DD/YYYY format.

What is the date format for Power Apps portals? ›

Portals: Changing the Date from the Default Format
  • Navigate to Portals in the dashboard.
  • Click on Site Settings.
  • Browse through the Site Setting records to check if you can find a record with “DateTime/DateFormat” in the Name field. ...
  • Open the record and edit the Value field to the desired date format string. ...
  • Click Save.

How do I format current date and time in Power Automate? ›

For ISO 8601 format, use: formatDateTime(variables('CurrentDate'), 'yyyy-MM-ddTHH:mm:ssZ'). For a 24 hours format, use: formatDateTime(variables('CurrentDate'), 'HH:mm'). To format date as a number, use: formatDateTime(variables('CurrentDate'), 'yyyyMMdd').

How do I change the date format in power? ›

To adjust the date format in the data model of Power BI, follow these steps:
  1. Select the date column in the data model.
  2. Under the “Modeling” tab, click on the “Format” dropdown menu.
  3. Choose the desired date format from the available options.
  4. Apply the selected date format to the date column.

References

Top Articles
Latest Posts
Article information

Author: Gregorio Kreiger

Last Updated:

Views: 5499

Rating: 4.7 / 5 (57 voted)

Reviews: 88% of readers found this page helpful

Author information

Name: Gregorio Kreiger

Birthday: 1994-12-18

Address: 89212 Tracey Ramp, Sunside, MT 08453-0951

Phone: +9014805370218

Job: Customer Designer

Hobby: Mountain biking, Orienteering, Hiking, Sewing, Backpacking, Mushroom hunting, Backpacking

Introduction: My name is Gregorio Kreiger, I am a tender, brainy, enthusiastic, combative, agreeable, gentle, gentle person who loves writing and wants to share my knowledge and understanding with you.