Class DateOperators.Timezone
java.lang.Object
org.springframework.data.mongodb.core.aggregation.DateOperators.Timezone
- Enclosing class:
- DateOperators
Timezone represents a MongoDB timezone abstraction which can be represented with a timezone ID or offset as a
NOTE: Support for timezones in aggregations Requires MongoDB 3.6 or later.
String
. Also accepts a AggregationExpression
or Field
that resolves to a String
of
either Olson Timezone Identifier or a UTC Offset.Format | Example |
---|---|
Olson Timezone Identifier | "America/New_York" "Europe/London" "GMT" |
UTC Offset | +/-[hh]:[mm], e.g. "+04:45" -[hh][mm], e.g. "-0530" +/-[hh], e.g. "+03" |
- Since:
- 2.1
- Author:
- Christoph Strobl, Mark Paluch
-
Method Summary
Modifier and TypeMethodDescriptionstatic DateOperators.Timezone
fromOffset
(ZoneOffset offset) Create aDateOperators.Timezone
for the givenZoneOffset
rendering the offset as UTC offset.static DateOperators.Timezone
fromOffset
(TimeZone timeZone) Create aDateOperators.Timezone
for the givenTimeZone
rendering the offset as UTC offset.static DateOperators.Timezone
Create aDateOperators.Timezone
for the givenZoneId
rendering the offset as UTC offset.static DateOperators.Timezone
Create aDateOperators.Timezone
for the givenTimeZone
rendering the offset as UTC offset.static DateOperators.Timezone
none()
Return an emptyDateOperators.Timezone
.static DateOperators.Timezone
ofExpression
(AggregationExpression expression) Create aDateOperators.Timezone
for theAggregationExpression
resulting in the Olson Timezone Identifier or UTC Offset.static DateOperators.Timezone
Create aDateOperators.Timezone
for theField
reference holding the Olson Timezone Identifier or UTC Offset.static DateOperators.Timezone
Create aDateOperators.Timezone
for the given value which must be a valid expression that resolves to aString
representing an Olson Timezone Identifier or UTC Offset.
-
Method Details
-
none
Return an emptyDateOperators.Timezone
.- Returns:
- never null.
-
valueOf
Create aDateOperators.Timezone
for the given value which must be a valid expression that resolves to aString
representing an Olson Timezone Identifier or UTC Offset.- Parameters:
value
- the plain timezoneString
, aField
holding the timezone or anAggregationExpression
resulting in the timezone.- Returns:
- new instance of
DateOperators.Timezone
.
-
fromOffset
Create aDateOperators.Timezone
for the givenTimeZone
rendering the offset as UTC offset.- Parameters:
timeZone
-TimeZone
rendering the offset as UTC offset.- Returns:
- new instance of
DateOperators.Timezone
. - Since:
- 3.3
-
fromOffset
Create aDateOperators.Timezone
for the givenZoneOffset
rendering the offset as UTC offset.- Parameters:
offset
-ZoneOffset
rendering the offset as UTC offset.- Returns:
- new instance of
DateOperators.Timezone
. - Since:
- 3.3
-
fromZone
Create aDateOperators.Timezone
for the givenTimeZone
rendering the offset as UTC offset.- Parameters:
timeZone
-DateOperators.Timezone
rendering the offset as zone identifier.- Returns:
- new instance of
DateOperators.Timezone
. - Since:
- 3.3
-
fromZone
Create aDateOperators.Timezone
for the givenZoneId
rendering the offset as UTC offset.- Parameters:
zoneId
-ZoneId
rendering the offset as zone identifier.- Returns:
- new instance of
DateOperators.Timezone
. - Since:
- 3.3
-
ofField
Create aDateOperators.Timezone
for theField
reference holding the Olson Timezone Identifier or UTC Offset.- Parameters:
fieldReference
- theField
holding the timezone.- Returns:
- new instance of
DateOperators.Timezone
.
-
ofExpression
Create aDateOperators.Timezone
for theAggregationExpression
resulting in the Olson Timezone Identifier or UTC Offset.- Parameters:
expression
- theAggregationExpression
resulting in the timezone.- Returns:
- new instance of
DateOperators.Timezone
.
-