DateTimeValue

converts a DateTime string to a date/time value.

The DateTimeValue() function in Power FX converts a string representing both date and time into a date/time value.

AppAlloy works with date and time data in ISO 8601 format (e.g., "2024-09-18T14:00:00Z"). You will need to use the DateTimeValue() function to convert this ISO string into a usable date/time value for further comparison or calculation.

Syntax

DateTimeValue(ThisItem.DateTimeColumn)

DateTimeColumn: The column contains the data of both date and time that you want to convert into a date/time value.

Examples

In the table Project Track to track the records of the Project's tasks, there is a column StartDateTime.

You set the logic that once a task is submitted as completed, the total hours spent on the task is calculated immediately with the end time considered as the current Date Time of submission.

In this case, the Date and Time of submission is defined by Now(). Then, you can calculate the total hours spent on the task by the formula below:

Datediff(DateTimeValue(ThisItem.StartDateTime), Now(), Hours)

StartDateTime = September 18, 2024, 3:00 PM

DateTimeValue(ThisItem.StartDateTime) = 18/09/2024 15:00:00

Now() = 21/09/2024 12:00:00

Result: 69

Last updated