Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
EXTRACT
Gibt einen Teil eines Datums zurück.
Verwendungsbeispiel
EXTRACT(QUARTER FROM Order Date)
Syntax
1) Gibt einen Teil eines Datums zurück.
EXTRACT( part FROM date_expression )
2) Gibt ein Datum aus einem Feld oder einem Ausdruck vom Typ „Datum und Uhrzeit“ zurück.
EXTRACT(DATE FROM date_expression )
Parameter
date_expression: Ein Feld oder Ausdruck vom Typ „Datum“ oder „Datum und Uhrzeit“.
part: Der Teil des Datums, der zurückgegeben werden soll. EXTRACT unterstützt die folgenden Komponenten:
DAYOFWEEK : Gibt Werte im Bereich [1, 7] mit Sonntag als dem ersten Tag der Woche zurück.
DAY
DAYOFYEAR
WEEK : gibt die Kalenderwoche des Datums im Bereich [0, 53] zurück. Wochen beginnen am Sonntag und Datumsangaben vor dem ersten Sonntag des Jahres liegen in Woche 0.
ISOWEEK : Gibt die Wochennummer von date_expression im ISO 8601-Format zurück. ISOWEEK beginnt am Montag. Es werden Werte im Bereich [1, 53] zurückgegeben. Die erste ISOWEEK eines ISO-Jahres beginnt am Montag vor dem ersten Donnerstag des gregorianischen Kalenderjahres.
MONTH
QUARTER : Gibt Werte im Bereich [1, 4] zurück.
YEAR
ISOYEAR : Gibt das Kalenderjahr mit ISO 8601-Wochennummerierung zurück. Das entspricht dem gregorianischen Kalenderjahr mit dem Donnerstag der Woche, zu der date_expression gehört.
Rückgabedatentypen
Zahl (Ganzzahl)
Datum
Beispiele
Im folgenden Beispiel gibt EXTRACT einen Wert zurück, der dem Datumsteil DAY entspricht.
Beispielformel
Ausgabe
EXTRACT(DAY FROM DATE '2013-12-25')
25
Im folgenden Beispiel gibt EXTRACT Werte zurück, die verschiedenen Zeiträumen aus einer Datumsspalte gegen Ende des Jahres entsprechen.
Feldname
Beispielformel
Isoyear
EXTRACT(ISOYEAR FROM Date)
Isoweek
EXTRACT(ISOWEEK FROM Date)
Year
EXTRACT(YEAR FROM Date)
Week
EXTRACT(WEEK FROM Date)
Ausgabe:
Eingabedatum
Isoyear
Isoweek
Jahr
Woche
2015-12-23
2015
52
2015
51
2015-12-24
2015
52
2015
51
2015-12-25
2015
52
2015
51
2015-12-26
2015
52
2015
51
2015-12-27
2015
52
2015
52
2015-12-28
2015
53
2015
52
2015-12-29
2015
53
2015
52
2015-12-30
2015
53
2015
52
2015-12-31
2015
53
2015
52
2016-01-01
2015
53
2016
0
2016-01-02
2015
53
2016
0
2016-01-03
2015
53
2016
1
2016-01-04
2016
1
2016
1
2016-01-05
2016
1
2016
1
2016-01-06
2016
1
2016
1
2016-01-07
2016
1
2016
1
2016-01-08
2016
1
2016
1
2016-01-09
2016
1
2016
1
Hinweise
Diese Funktion ist für Typen von Kompatibilitätsmodus-Daten nicht verfügbar.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-07-31 (UTC)."],[],[],null,["EXTRACT\n=======\n\nReturns part of a date.\n\nSample usage\n------------\n\n`EXTRACT(QUARTER FROM Order Date)`\n\nSyntax\n------\n\n1) Returns a date part.\n\n`EXTRACT( `\u003cvar translate=\"no\"\u003epart\u003c/var\u003e` FROM `\u003cvar translate=\"no\"\u003edate_expression\u003c/var\u003e` )`\n\n2) Returns a Date from a Date \\& Time field or expression.\n\n`EXTRACT(DATE FROM `\u003cvar translate=\"no\"\u003edate_expression\u003c/var\u003e` )`\n\n### Parameters\n\n\u003cvar translate=\"no\"\u003edate_expression\u003c/var\u003e - a Date or a Date \\& Time field or expression.\n\n\u003cvar translate=\"no\"\u003epart\u003c/var\u003e - the date part to return. `EXTRACT` supports the following parts:\n\n- `DAYOFWEEK` : Returns values in the range \\[1, 7\\] with Sunday as the first day of the week.\n- `DAY`\n- `DAYOFYEAR`\n- `WEEK` : Returns the week number of the date in the range \\[0, 53\\]. Weeks begin with Sunday, and dates prior to the first Sunday of the year are in week 0.\n- `ISOWEEK` : Returns the [ISO 8601 week](https://en.wikipedia.org/wiki/ISO_week_date) number of the \u003cvar translate=\"no\"\u003edate_expression\u003c/var\u003e -. `ISOWEEK` s begin on Monday. Returns values in the range \\[1, 53\\]. The first `ISOWEEK` of each ISO year begins on the Monday before the first Thursday of the Gregorian calendar year.\n- `MONTH`\n- `QUARTER` : Returns values in the range \\[1, 4\\].\n- `YEAR`\n- `ISOYEAR` : Returns the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) week-numbering year, which is the Gregorian calendar year containing the Thursday of the week to which \u003cvar translate=\"no\"\u003edate_expression\u003c/var\u003e - belongs.\n\nReturn data types\n-----------------\n\n1. **Number** (integer)\n2. **Date**\n\nExamples\n--------\n\nIn the following example, `EXTRACT` returns a value corresponding to the `DAY` time part.\n\nIn the following example, `EXTRACT` returns values corresponding to different time parts from a column of dates near the end of the year.\n\n**Output:**\n\nNotes\n-----\n\nThis function is not available for compatibility mode date 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)"]]