Date creation in Power Automate: Using the formatDateTime function or ISO date strings to represent specific dates.
Note: Power Automate works with ISO 8601 format: YYYY-MM-DDTHH:mm:ssZ
- Use formatDateTime() function with date string
- Use ISO 8601 format: "YYYY-MM-DD"
- Store the result in a variable or use directly
Use the string '2024-03-15' in formatDateTime function.
Power Automate processes the date string.
The result shows March 15, 2024 in the appropriate format.
Use formatDateTime('2024-03-15') to create March 15, 2024.
• ISO format: Use YYYY-MM-DD for date strings
• Hyphen separator: Separate year, month, day with hyphens
• Zero-padding: Months and days should be two digits
• Practice Tip: Remember Y-M-D order for date strings
- formatDateTime('2023-12-25') -- Christmas 2023
- formatDateTime('2024-01-01') -- New Year 2024
- formatDateTime('2024-10-31') -- Halloween 2024
- Always use YYYY-MM-DD format for date strings
- Pad single-digit months and days with zeros
- Power Automate handles leap years automatically
Q: What if I use an invalid date?
A: Power Automate will return an error. For example, formatDateTime('2024-02-30') fails because February doesn't have 30 days.
Q: Can I include time in the date string?
A: Yes! Use ISO 8601 format: formatDateTime('2024-03-15T14:30:00Z') for date and time.
Date comparison: Using comparison functions like less() or greater() to determine the relationship between two dates in Power Automate.
Note: Power Automate compares dates based on their internal representation.
- Create two date expressions
- Use comparison function (less, greater, equals)
- Evaluate the boolean result
less(formatDateTime('2024-03-15'), formatDateTime('2024-03-20'))
Power Automate evaluates the comparison and returns true/false.
Since March 15 is before March 20, the result is true.
Yes, March 15, 2024 is earlier than March 20, 2024.
• Comparison functions: Use less(), greater(), equals() for comparisons
• Boolean result: Comparison returns true or false
• Chronological order: Earlier dates are less than later dates
• Practice Tip: Test with known date relationships first
- less(formatDateTime('2024-01-01'), formatDateTime('2024-12-31')) -- returns true
- greater(formatDateTime('2024-05-15'), formatDateTime('2024-03-10')) -- returns true
- equals(formatDateTime('2024-04-01'), formatDateTime('2024-04-01')) -- returns true
- less() means "is earlier than", greater() means "is later than"
- Power Automate stores dates as numbers internally for comparison
- Time components matter in date comparisons if present
Q: What comparison functions can I use?
A: You can use less(), greater(), equals(), lessOrEquals(), greaterOrEquals().
Q: Does time matter in date comparison?
A: Yes! If dates include time, Power Automate compares both date and time components.
Greater than: Function that returns true if the first operand is later in time than the second operand.
Note: For dates, "greater than" means chronologically later.
- Create two date expressions
- Use the greater() function between them
- Evaluate the boolean result
greater(formatDateTime('2024-06-10'), formatDateTime('2024-03-15'))
Power Automate evaluates the comparison and returns true.
Since June 10 is after March 15, the result is true.
Yes, June 10, 2024 is greater than March 15, 2024.
• Greater than: greater() function returns true if left date is later
• Chronological logic: Later dates are greater than earlier dates
• Boolean evaluation: Result is always true or false
• Practice Tip: Think of the number line for date ordering
- greater(formatDateTime('2024-12-31'), formatDateTime('2024-01-01')) -- returns true
- greater(formatDateTime('2024-08-15'), formatDateTime('2024-08-10')) -- returns true
- greater(formatDateTime('2024-02-01'), formatDateTime('2024-12-31')) -- returns false
- greater() means "comes later in time"
- Think of dates on a timeline from left to right
- Any date in June > any date in March of the same year
Q: What if I compare dates in different years?
A: The year is considered first, then month, then day. greater('2023-12-31', '2024-01-01') returns false.
Q: Can I chain multiple comparisons?
A: Yes! You can use expressions like greater(date1, date2) and greater(date2, date3).
Less than: Function that returns true if the left operand is earlier in time than the right operand.
Note: For dates, "less than" means chronologically earlier.
- Create two date expressions
- Use the less() function between them
- Evaluate the boolean result
less(formatDateTime('2024-01-01'), formatDateTime('2024-02-14'))
Power Automate evaluates the comparison and returns true.
Since January 1 is before February 14, the result is true.
Yes, January 1, 2024 is less than February 14, 2024.
• Less than: less() function returns true if left date is earlier
• Chronological logic: Earlier dates are less than later dates
• Boolean evaluation: Result is always true or false
• Practice Tip: Remember: less() means "earlier than"
- less(formatDateTime('2024-01-01'), formatDateTime('2024-12-31')) -- returns true
- less(formatDateTime('2024-05-01'), formatDateTime('2024-05-15')) -- returns true
- less(formatDateTime('2024-10-31'), formatDateTime('2024-09-15')) -- returns false
- less() means "comes earlier in time"
- Think of the calendar year from January to December
- Any date in January < any date in February of the same year
Q: What happens if I compare the same dates?
A: less('2024-05-01', '2024-05-01') returns false since they're equal.
Q: Can I use lessOrEquals() for "less than or equal"?
A: Yes! lessOrEquals('2024-05-01', '2024-05-01') returns true.
Equality: Function that returns true if both operands represent the same date and time.
Note: For dates, equality means identical year, month, and day.
- Create two date expressions
- Use the equals() function between them
- Evaluate the boolean result
equals(formatDateTime('2024-03-15'), formatDateTime('2024-03-15'))
Power Automate evaluates the comparison and returns true.
Since both dates are identical, the result is true.
Yes, March 15, 2024 and March 15, 2024 are equal.
• Equality: equals() function returns true if dates are identical
• Exact match: Year, month, and day must all match
• Boolean evaluation: Result is always true or false
• Practice Tip: Use equals() to check for specific dates
- equals(formatDateTime('2024-12-25'), formatDateTime('2024-12-25')) -- returns true
- equals(formatDateTime('2024-01-01'), formatDateTime('2023-01-01')) -- returns false
- equals(formatDateTime('2024-07-04'), formatDateTime('2024-07-04')) -- returns true
- equals() checks for exact date match
- Year, month, and day must all be the same
- Use for validating specific dates like birthdays
Q: What if dates have different times?
A: If you include time components, they must also match for equality.
Q: Can I check inequality?
A: Yes! Use not(equals(date1, date2)) to check for inequality.