You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: documentation/src/main/asciidoc/querylanguage/Expressions.adoc
+28-1Lines changed: 28 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -687,7 +687,34 @@ The special function `extract()` obtains a single field of a date, time, or date
687
687
- Its first argument is an expression that evaluates to a date, time, or datetime.
688
688
- Its second argument is a date/time _field type_.
689
689
690
-
Field types include: `day`, `month`, `year`, `second`, `minute`, `hour`, `day of week`, `day of month`, `week of year`, `date`, `time`, `epoch` and more.
690
+
Field types include:
691
+
692
+
[cols="~,^15,^10,~"]
693
+
|===
694
+
| Field | Type | Range | Notes
695
+
696
+
| `day` | `Integer` | 1-31 | Calendar day of month
697
+
| `month` | `Integer` | 1-12 |
698
+
| `year` | `Integer` | |
699
+
| `week` | `Integer` | 1-53 | ISO-8601 week number (different to `week of year`)
700
+
| `quarter` | `Integer` | 1-4 | Quarter defined as 3 months
701
+
| `hour` | `Integer` | 0-23 | Standard 24-hour time
702
+
| `minute` | `Integer` | 0-59 |
703
+
| `second` | `Float` | 0-59 | Includes fractional seconds
704
+
| `nanosecond` | `Long` | | Granularity varies by database
705
+
| `day of week` | `Integer` | 1-7 |
706
+
| `day of month` | `Integer` | 1-31 | Synonym for `day`
707
+
| `day of year` | `Integer` | 1-365 |
708
+
| `week of month` | `Integer` | 1-5 |
709
+
| `week of year` | `Integer` | 1-53 |
710
+
| `epoch` | `Long` | | Elapsed seconds since January 1, 1970
711
+
| `date` | `LocalDate` | | Date part of a datetime
712
+
| `time` | `LocalTime` | | Time part of a datetime
For a full list of field types, see the Javadoc for https://docs.jboss.org/hibernate/orm/{majorMinorVersion}/javadocs/org/hibernate/query/TemporalUnit.html[`TemporalUnit`].
NOTE: Aggregate functions usually appear in the `select` clause, but control over aggregation is the responsibility of the `group by` clause, as described <<hql-group-by,below>>.
0 commit comments