Forum Discussion

Ad_456's avatar
Ad_456
Frequent Visitor
3 years ago
Solved

Convert DateTime to Date

How can I convert a DateTime value to a Date? (in DAX)
For example:

Date_refresh =
VAR UTC_DateTimeZone = UTCNOW()
VAR UTC_Date = ?
Return UTC_Date

How can I fill UTC_Date with the date value of UTCNOW()?
  • Hi Ad_456 ,

     

    You could try below code:-

     

     

    Date_refresh = 
    VAR UTC_DateTimeZone = UTCNOW()
    VAR UTC_Date = FORMAT(UTC_DateTimeZone,"mm/dd/yyyy")
    Return UTC_Date

    or 

    You could change data format directly from the ribbon.

    Date_refresh = UTCNOW()

     

     

     

2 Replies

  • Samarth_18's avatar
    Samarth_18
    Community Champion

    Hi Ad_456 ,

     

    You could try below code:-

     

     

    Date_refresh = 
    VAR UTC_DateTimeZone = UTCNOW()
    VAR UTC_Date = FORMAT(UTC_DateTimeZone,"mm/dd/yyyy")
    Return UTC_Date

    or 

    You could change data format directly from the ribbon.

    Date_refresh = UTCNOW()

     

     

     

  • Ad_456's avatar
    Ad_456
    Frequent Visitor

    Yes, thank you for this answer. That's exactly what I am looking for.