how to change date format to 'mm/dd/yyyy' from 'yyyy-mm-dd'

Tanaji
New Member

I am trying

dimension: tdate {
type: date
sql: DATE_FORMAT(${TABLE}.“TDATE”,’%m/%d/%Y’) ;;
}

but not getting output

0 6 8,993
6 REPLIES 6

You cannot control the format of a type: date dimension.

Try with type: string, that should do the trick

It worked for me on Snowflake:

  dimension: date_format {
    type: string
    sql: to_char(${TABLE}.created_at, 'MM/DD/YYYY') ;;

craigr
New Member

I would not recommend using the type: string method, as you lose the advantages that come with type: date dimensions (such as dimension fill and dynamic labels). Instead use the html tag to convert your date dimension into the format that you want.

dimension: tdate_formatted {
sql: ${TABLE}.“TDATE” ;;
html: {{ rendered_value | date: “%m/%d/%Y" }} ;;
}

sri75
New Member

i know this is an old thread but can we set the default date format for a dashboard filter to be mm/dd/yyyy instead of yyyy/mm/dd

How can you do that @sri75 ? I can’t see that option in my dashboards!!!

@sri75 could you share how you did this please? 

Top Labels in this Space
Top Solution Authors