📆Date and Time Functions in PowerApps: The Definitive Guide
1. Introduction to Date and Time Functions in PowerApps
When building business applications, working with dates and times is unavoidable. Whether you’re creating a leave request form, booking system, expense tracker, or time-based reports, Date and Time Functions in PowerApps are essential for accurate data processing, validation, and presentation.
PowerApps offers a rich set of functions for handling dates and times effectively. These include fetching the current time, extracting date parts, performing calculations, formatting, and managing time zones—all critical features for modern app development.
Table of Contents – Date and Time Functions in PowerApps
- Introduction
- Why Use Date and Time Functions in PowerApps
- Overview of Date and Time Functions in PowerApps
- Getting the Current Date and Time: Now, Today, UTCNow
- Extracting Components: Year, Month, Day, Hour, Minute, Second, Weekday
- Working with Time Zones in PowerApps
- Date and Time Arithmetic: DateAdd, DateDiff
- Formatting Dates and Times with the Text Function
- User Input for Dates and Times: Date Picker and Time Picker
- Common Use Cases
- Best Practices
- Common Mistakes and How to Avoid Them
- Conclusion
2. Why Use Date and Time Functions in PowerApps
- Automate due dates and deadlines
- Create filters for data within specific date ranges
- Validate time-based inputs
- Format timestamps for reports and dashboards
- Compare submission or approval dates
- Schedule tasks or reminders dynamically
3. Overview of Date and Time Functions in PowerApps
Function | Description |
---|---|
Now() |
Returns the current date and time |
Today() |
Returns the current date without time |
UTCNow() |
Returns the current UTC date and time |
Year() |
Extracts the year from a date |
Month() |
Extracts the month from a date |
Day() |
Extracts the day from a date |
Hour() |
Extracts the hour from a time |
Minute() |
Extracts the minute from a time |
Second() |
Extracts the second from a time |
Weekday() |
Returns the day of the week as a number |
DateAdd() |
Adds days, months, or years to a date |
DateDiff() |
Calculates the difference between two dates |
Text() |
Formats date and time for display |
4. Getting the Current Date and Time: Now, Today, UTCNow
Now()
Returns the system’s current date and time.
Now()
Example:
Label1.Text = "Current Time: " & Text(Now(), "hh:mm:ss")
Today()
Returns the current date without the time portion.
Today()
UTCNow()
Useful for global apps needing a universal timestamp.
UTCNow()
5. Extracting Components: Year, Month, Day, Hour, Minute, Second, Weekday
Year()
Year(Now()) // Returns 2025
Month()
Month(Now()) // Returns 6 (for June)
Day()
Day(Now()) // Returns 28
Hour(), Minute(), Second()
Hour(Now()) // Returns current hour
Minute(Now()) // Current minute
Second(Now()) // Current second
Weekday()
Returns the day of the week (Sunday = 1 by default).
Weekday(Now()) // Returns 7 for Saturday
6. Working with Time Zones in PowerApps
Time zone management is critical in global applications.
Now()
returns the local device time.UTCNow()
returns Coordinated Universal Time.
To convert between UTC and local:
DateAdd(UTCNow(), TimeZoneOffset(), Minutes)
To save in UTC and convert to local:
DateAdd(savedUTCDate, -TimeZoneOffset(savedUTCDate), Minutes)
7. Date and Time Arithmetic: DateAdd, DateDiff
DateAdd()
Adds or subtracts time from a date.
DateAdd(Now(), 7, Days) // Adds 7 days
DateAdd(Now(), -1, Months) // Subtracts 1 month
DateDiff()
Calculates the difference between two dates.
DateDiff(StartDate, EndDate, Days)
Example: Calculate age
DateDiff(DatePicker1.SelectedDate, Today(), Years)
8. Formatting Dates and Times with the Text Function
Use Text()
to display dates and times in custom formats.
Date Formatting
Text(Today(), "dd-mm-yyyy") // 28-06-2025
Text(Now(), "mmmm dd, yyyy") // June 28, 2025
Time Formatting
Text(Now(), "hh:mm:ss AM/PM") // 10:12:00 PM
Full Formatting
Text(Now(), "dddd, mmmm dd, yyyy hh:mm:ss")
9. User Input for Dates and Times: Date Picker and Time Picker
Date Picker Control
Users can select a date. Value is stored as a date object.
DatePicker1.SelectedDate
Time Input
Though PowerApps doesn’t have a dedicated time picker, use dropdowns or sliders for hours and minutes.
To combine date and time:
DateAdd(DatePicker1.SelectedDate, SliderHour.Value, Hours)
10. Common Use Cases of Date and Time Functions in PowerApps
A. Calculating Due Dates
DateAdd(Today(), 14, Days)
B. Age Calculation
DateDiff(DatePicker1.SelectedDate, Today(), Years)
C. Filter Data by Date Range
Filter(Tasks, DueDate >= Today() && DueDate <= DateAdd(Today(), 7, Days))
D. Dynamic Greetings Based on Time
If(
Hour(Now()) < 12, "Good Morning",
Hour(Now()) < 17, "Good Afternoon",
"Good Evening"
)
E. Store UTC Date and Show Local
DateAdd(SavedUTCDate, -TimeZoneOffset(SavedUTCDate), Minutes)
11. Best Practices for Date and Time Functions in PowerApps
- Use UTCNow for server-side consistency.
- Always format dates for display using
Text()
. - Store timestamps in UTC to avoid ambiguity.
- Use
DateDiff()
for calculating age, duration, etc. - Avoid hardcoding formats—use locale-aware strings.
- Test behavior across time zones and devices.
12. Common Mistakes and How to Avoid Them
Mistake | Solution |
---|---|
Confusing Now() and UTCNow() |
Use UTCNow() when consistency is needed across users. |
Storing local time directly | Always store in UTC; convert only on display. |
Ignoring user time zone | Use TimeZoneOffset() to calculate differences. |
Not formatting dates | Use Text() for readable and consistent output. |
Using text fields instead of date types | Use DatePicker for reliability. |
13. Conclusion
Date and Time Functions in PowerApps are essential for building apps that handle scheduling, reporting, filtering, and user engagement. From capturing timestamps with Now()
and UTCNow()
to manipulating them with DateAdd()
, DateDiff()
, and formatting them with Text()
, these functions give developers powerful tools to manage time-related data.
Whether you’re creating a timesheet app, leave management system, or tracking deadlines, using Date and Time Functions in PowerApps correctly ensures your data is accurate, your UI is clear, and your app logic is reliable.
Mastering these functions allows you to:
- Build scalable and region-aware applications
- Display meaningful and dynamic data
- Reduce errors related to date calculations
- Improve overall user experience