# The original dimension group - hidden so that users can only choose from the formatted dates date and week timeframes
dimension_group: created {
hidden: yes
type: time
timeframes: [
raw,
time,
date,
hour,
hour_of_day,
time_of_day,
week,
month,
quarter,
year
]
sql: ${TABLE}.created_at ;;
}
# The customized timeframes, organized in the Explore field picker under the group label Created date
dimension: date_formatted {
group_label: "Created date"
label: "Date"
type: date_raw
sql: ${created_date} ;;
html: {{ rendered_value | date: "%b %d, %y" }};;
}
dimension: week_formatted {
group_label: "Created date"
label: "Week"
type: date_raw
sql: ${created_week} ;;
html: {{ rendered_value | date: "Week %U (%b %d)" }};;
}
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["わかりにくい","hardToUnderstand","thumb-down"],["情報またはサンプルコードが不正確","incorrectInformationOrSampleCode","thumb-down"],["必要な情報 / サンプルがない","missingTheInformationSamplesINeed","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-07-30 UTC。"],[],[],null,["# How to use Liquid to format dates\n\nIn some situations, you may want to change the way Looker formats dates.\n\n\nFor example, if you're building Explores and dashboards for users in Europe, any dates that are in an all-numeric format should appear in the order Day-Month-Year. For example, June 7th, 2019 should be formatted as `07/06/2019` or `Jun 07, 2019`. Looker's default format renders the date as `2019-06-07`. While you can use SQL functions like `DATE_FORMAT()` to change a date format, you may not want to write everything in plain SQL.\n\nUsing Liquid in the `html` parameter\n------------------------------------\n\n| **Note:** When [downloading content](/looker/docs/downloading), Liquid formatting applied in the [`html`](/looker/docs/reference/param-field-html) parameter is not applied to text-based download formats, such as TXT, CSV, Excel, or JSON.\n\n\nYou can use [Liquid formatting](https://shopify.github.io/liquid/filters/date/) in the [`html`](/looker/docs/reference/param-field-html) parameter of a dimension to change the format of any field that uses a valid date format. Since Liquid expects a valid date, it is best to use the timeframes from an existing dimension group. You can't change the week or month *numbers*, because those are returned as integers.\n| **Caution:** Liquid formatting is not supported for the [`month`](/looker/docs/reference/param-field-dimension-group#time_type) timeframe.\n\n\nFor example, you can format `${created_date}` to render as `Aug 23 22` instead of the Looker default `2022-08-23`: \n\n```\n\n dimension: date_formatted {\n sql: ${created_date} ;;\n html:{{ rendered_value | date: \"%b %d, %y\" }};;\n }\n\n\n```\n\n\nThe format for the string syntax `\"%b %d, %y\"` is the same as [`strftime`](http://strftime.net).\n\n\nBecause the `html` parameter uses Liquid formatting, the original value of the timeframe is not changed --- only the way that the value is rendered to the user. This ensures that the order in which dates appear in a query will not change.\n\n\nFollowing are some other examples you can use. The larger reference of available formats is at the bottom of this page.\n\nExample\n-------\n\n\nThe following example of an Explore query shows **Order Items Date** and **Orders Items Week** formatted differently and organized under a **Created date** group label to simulate a date dimension group in the Explore field picker.\n\n\nThe custom formatting shows users which date and which week number of the year correspond to the largest **Count of Items** values in descending order.\n\n\nSee the [`group_label` documentation page](/looker/docs/reference/param-field-group-label) to learn more about using the `group_label` parameter.\n\n\n### The LookML\n\n\nThe Explore example uses the following LookML: \n\n```\n\n\n# The original dimension group - hidden so that users can only choose from the formatted dates date and week timeframes\n dimension_group: created {\n hidden: yes\n type: time\n timeframes: [\n raw,\n time,\n date,\n hour,\n hour_of_day,\n time_of_day,\n week,\n month,\n quarter,\n year\n ]\n sql: ${TABLE}.created_at ;;\n }\n\n# The customized timeframes, organized in the Explore field picker under the group label Created date\n dimension: date_formatted {\n group_label: \"Created date\"\n label: \"Date\"\n type: date_raw\n sql: ${created_date} ;;\n html: {{ rendered_value | date: \"%b %d, %y\" }};;\n }\n\n dimension: week_formatted {\n group_label: \"Created date\"\n label: \"Week\"\n type: date_raw\n sql: ${created_week} ;;\n html: {{ rendered_value | date: \"Week %U (%b %d)\" }};;\n }\n\n\n```\n\n`strftime Reference`\n--------------------\n\n\nThe following table lists various `strftime` formats. Please note that not all formats may render as expected in Looker.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e"]]