DATEVALUE
A date read from text, its time dropped.
Group: Date and time. Compatible with DAX.
Syntax
DATEVALUE ( <date_text> )
| Parameter | Type | Description |
|---|---|---|
date_text | Text | Text that holds a date, with or without a time. |
Returns
Date. The date the text names, at midnight.
Remarks
- Any time in the text is dropped. A text that holds a time only gives 30 December 1899, day 0.
- The text is read the way the model's culture writes dates. 2024-03-15 reads the same in every culture; 3/4/2024 is 4 March in a model whose culture is en-US and 3 April in one that puts the day first.
- Text that is no date is an error. So is a number: it is read as its digits, and 45000 names no date.
- A blank gives BLANK.
Examples
The date out of a date and time
DATEVALUE keeps the date, TIMEVALUE the time.
EVALUATE
ROW (
"DATEVALUE", DATEVALUE ( "2024-03-15 14:30" ),
"TIMEVALUE", TIMEVALUE ( "2024-03-15 14:30" )
)
| DATEVALUE | TIMEVALUE |
|---|---|
| 2024-03-15 | 1899-12-30 14:30:00 |
When the text names no date
The failure is caught and turned into a blank.
EVALUATE
ROW ( "Read", IFERROR ( DATEVALUE ( "not a date" ), BLANK () ) )
| Read |
|---|
| (blank) |