[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-07-31 UTC."],[],[],null,["TODATE\n======\n\nReturns a formatted compatibility mode date.\n| **Important:** This function only supports compatibility mode dates.\n|\n| We recommend upgrading any older date fields in your data sources to the new Date or Date \\& Time types. After upgrading:\n|\n| - You can use the `FORMAT_DATETIME` function to format a date as text.\n| - You can use the `PARSE_DATE` and `PARSE_DATETIME` functions to convert text into Date and Date \\& Time fields.\n|\n| \u003cbr /\u003e\n|\n| [Learn more](/looker/docs/studio/formatdatetime).\n\nYou can use `TODATE` in 2 ways:\n\n- Create a compatibility mode date from Text fields.\n- Change the display format and granularity of a compatibility mode date.\n\nSample usage\n------------\n\n`TODATE(Text_Date,\"%Y/%m/%d\",\"%Y-%m-%d\")`\n\n`TODATE(Text_Date,\"%Y/%m/%d\",\"%Y-%m-%d\")`\n\n`TODATE(Response_Time, 'MILLIS', '%Y%m%d')`\n\n`TODATE(Created_Time, 'DECIMAL_DATE', '%Y')`\n\nSyntax\n------\n\n`TODATE(`\u003cvar translate=\"no\"\u003efield_expression\u003c/var\u003e`, `\u003cvar translate=\"no\"\u003einput_date_format\u003c/var\u003e`, `\u003cvar translate=\"no\"\u003eoutput_date_format\u003c/var\u003e`)`\n\nInput formats\n-------------\n\n\u003cvar translate=\"no\"\u003einput_date_format\u003c/var\u003e is optional if \u003cvar translate=\"no\"\u003efield_expression\u003c/var\u003e is correctly configured as a semantic date.\n\n`TODATE` accepts the following input format strings.\n\n- 'BASIC': %Y/%m/%d-%H:%M:%S\n\n- 'DEFAULT_DASH': %Y-%m-%d \\[%H:%M:%S\\]\n\n- 'DEFAULT_SLASH': %Y/%m/%d \\[%H:%M:%S\\]\n\n- 'DEFAULT_DECIMAL': %Y%m%d \\[%H:%M:%S\\]\n\n- 'RFC_1123': for example, Sat, 24 May 2008 20:09:47 GMT\n\n- 'RFC_3339': for example, 2008-05-24T20:09:47Z\n\n- 'SECONDS': seconds since Epoch\n\n- 'MILLIS': milliseconds since Epoch\n\n- 'MICROS': microseconds since Epoch\n\n- 'NANOS': nanoseconds since Epoch\n\n- 'JULIAN_DATE': days since Epoch\n\n- 'DECIMAL_DATE': same as 'DEFAULT_DECIMAL'\n\n- Any valid [strptime](http://pubs.opengroup.org/onlinepubs/009695399/functions/strptime.html) format. Optional if the value is already a datetime field.\n\nOutput formats\n--------------\n\n`TODATE` accepts the following output format strings:\n\n- \"%Y\" - year\n- \"%m\" - month\n- \"%d\" - day\n- \"%W\" - yearweek number\n- \"%w\" - day of week\n- \"%H\" - hour\n- \"%M\" - minute\n\n### Examples\n\nNotes\n-----\n\n`TODATE` returns compatibility mode Date data types.\n\nRelated resources\n-----------------\n\n- [Dates and times](/looker/docs/studio/dates-and-times)\n- [Calculated fields](/looker/docs/studio/about-calculated-fields)\n- [Looker Studio function list](/looker/docs/studio/function-list)"]]