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

I am trying

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

but not getting output

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') ;;
1 Like

This likely would suit your purpose:

https://help.looker.com/hc/en-us/articles/360023800253-Easy-Date-Formatting-with-Liquid

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" }} ;;
}

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

4 Likes

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

@sri75 could you share how you did this please?