DATEVALUE DAX Function (Date and Time)
Converts a date in the form of text to a date in datetime format.
Syntax
| Parameter | Attributes | Description |
|---|---|---|
| DateText |
A text string that represents a date. |
Return values
A date in datetime format.
Remarks
DATEVALUE uses the locale of the model to read DateText. For example, if the locale shows dates as month/day/year, “1/8/2009” returns January 8, 2009. If the locale shows dates as day/month/year, the same string returns August 1, 2009. The application and the computer that create the model define its locale.
If DateText is not valid with the locale of the model, DATEVALUE tries other date formats before it returns an error. Thus, “1/31/2009” returns January 31, 2009 with any locale. Different rows can use different formats. For example, with a month/day/year locale, “5/4/2018” returns May 4, 2018, and “20/4/2018” returns April 20, 2018.
The YYYY-MM-DD format does not depend on the locale. For example, “2020-02-06” returns February 6, 2020.
If DateText does not include the year, DATEVALUE uses the current year. A two-digit year from 0 to 49 is a year from 2000 to 2049, and a two-digit year from 50 to 99 is a year from 1950 to 1999.
DATEVALUE ignores the time part. For example, “2020-02-06 13:45:10” returns February 6, 2020 at midnight. A string with only a time returns December 30, 1899. The ISO format with T before the time, for example “2020-02-06T13:45:10”, returns an error.
If DateText is BLANK, the result is BLANK. An empty string, a string that is not a valid date, or a number, for example DATEVALUE ( 45000 ), returns an error.
You do not need DATEVALUE for a constant date: use a date literal with the dt prefix, for example dt”2020-02-06″. The formats dt”YYYY-MM-DDThh:mm:ss” and dt”YYYY-MM-DD hh:mm:ss” are also valid.
Examples
-- DATEVALUE/TIMEVALUE convert strings into dates and times
EVALUATE
{
DATEVALUE ( "10/15/2020" ),
DATEVALUE ( "10-15-2020" ),
TIMEVALUE ( "12:45:01" ),
TIMEVALUE ( "12.45.01 AM" ),
TIMEVALUE ( "15:45:01 AM" )
}
| Value |
|---|
| 2020-10-15 00:00:00 |
| 2020-10-15 00:00:00 |
| 1899-12-30 12:45:01 |
| 1899-12-30 00:45:01 |
| 1899-12-30 15:45:01 |
-- If month and day are exchanged, the conversion still works
-- The default is defined by the international settings
EVALUATE
{
DATEVALUE ( "28/02/2020" ),
DATEVALUE ( "02/28/2020" ),
DATEVALUE ( "08/10/2020" ), -- 10th of August
DATEVALUE ( "2020-02-06" )
}
| Value |
|---|
| 2020-02-28 |
| 2020-02-28 |
| 2020-08-10 |
| 2020-02-06 |
Related functions
Other related functions are:
Last update: Nov 10, 2026 » Contribute » Show contributors
Contributors: Alberto Ferrari, Marco Russo
Microsoft documentation: https://learn.microsoft.com/en-us/dax/datevalue-function-dax