Pada contoh ini, DateTimeText adalah kolom yang berisi tanggal dan waktu teks. Hasil penerapan PARSE_DATETIME dengan format_string yang benar adalah nilai Tanggal & Waktu.
Contoh formula
Input
Output
PARSE_DATETIME("%d/%m/%y %H:%M:%S", DateTimeText)
25/12/08 12:12:12
2008-12-25 12:12:12
Contoh berikut menguraikan kolom DateTimeText yang berisi tanggal ke dalam format bahasa alami sebagai nilai Tanggal & Waktu.
Contoh formula
Input
Output
PARSE_DATETIME('%A, %B %e, %Y', DateTimeText)
Wednesday, December 19, 2018
2018-12-19 00:00:00
Catatan
Saat menggunakan PARSE_DATETIME, perhatikan hal berikut:
Kolom yang tidak ditentukan. Semua kolom yang tidak ditentukan akan dimulai dari 1970-01-01.
Nama tidak peka huruf besar-kecil. Nama, seperti Senin, Februari, dan sebagainya, tidak peka huruf besar/kecil.
Spasi kosong. Satu atau beberapa spasi kosong berturut-turut dalam string format akan cocok dengan nol atau beberapa spasi kosong berturut-turut dalam string tanggal. Selain itu, spasi kosong di depan dan belakang string tanggal selalu diizinkan, meskipun tidak berada dalam string format.
Prioritas format. Jika dua elemen format (atau lebih) memiliki informasi yang tumpang-tindih (misalnya, %F dan %Y memengaruhi tahun), elemen terakhir umumnya akan menggantikan elemen yang lebih awal.
Fungsi ini mendukung elemen format, tetapi tidak sepenuhnya mendukung %Q, %a, %A, %g, %G, %j, %u, %U, %V, %w, and %W. Lihat Elemen Format yang Didukung untuk DATETIME untuk melihat daftar elemen format yang didukung oleh fungsi ini.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-07-31 UTC."],[],[],null,["PARSE_DATETIME\n==============\n\nConverts text to a date with time.\n\nSample usage\n------------\n\n`PARSE_DATETIME(\"%f\", DateTimeText)`\n\nSyntax\n------\n\n`PARSE_DATETIME( `\u003cvar translate=\"no\"\u003eformat_string\u003c/var\u003e`, `\u003cvar translate=\"no\"\u003etext\u003c/var\u003e` )`\n\n### Parameters\n\n\u003cvar translate=\"no\"\u003eformat_string\u003c/var\u003e - See [Supported Format Elements For DATETIME](https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#format_elements_date_time) for a list of format elements that this function supports.\n\n\u003cvar translate=\"no\"\u003etext\u003c/var\u003e - a text representation of a date.\n\nReturn data type\n----------------\n\nDate \\& Time\n\nExamples\n--------\n\nIn this example, DateTimeText is a field containing a text date and time. The result of applying `PARSE_DATETIME` with the correct *format_string* is a Date \\& Time value.\n\nThe following example parses the *DateTimeText* field containing a date in a natural language format as a Date \\& Time value.\n\nNotes\n-----\n\nWhen using `PARSE_DATETIME`, keep the following in mind:\n\n- **Unspecified fields**. Any unspecified field is initialized from 1970-01-01.\n- **Case insensitive names**. Names, such as Monday, February, and so on, are case insensitive.\n- **Whitespace**. One or more consecutive white spaces in the format string matches zero or more consecutive white spaces in the date string. In addition, leading and trailing white spaces in the date string are always allowed -- even if they are not in the format string.\n- **Format precedence** . When two (or more) format elements have overlapping information (for example both `%F` and `%Y` affect the year), the last one generally overrides any earlier ones.\n\n\u003e This function supports format elements, but does not have full support for `%Q, %a, %A, %g, %G, %j, %u, %U, %V, %w, and %W.` See [Supported Format Elements For DATETIME](https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#format_elements_date_time) for a list of format elements that this function supports.\n\nRelated resources\n-----------------\n\n- [Calculated fields](/looker/docs/studio/about-calculated-fields)\n- [Looker Studio function list](/looker/docs/studio/function-list)"]]