Module spring.data.mongodb
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.TimezonefromOffset(ZoneOffset offset) Create aDateOperators.Timezonefor the givenZoneOffsetrendering the offset as UTC offset.static DateOperators.TimezonefromOffset(TimeZone timeZone) Create aDateOperators.Timezonefor the givenTimeZonerendering the offset as UTC offset.static DateOperators.TimezoneCreate aDateOperators.Timezonefor the givenZoneIdrendering the offset as UTC offset.static DateOperators.TimezoneCreate aDateOperators.Timezonefor the givenTimeZonerendering the offset as UTC offset.static DateOperators.Timezonenone()Return an emptyDateOperators.Timezone.static DateOperators.TimezoneofExpression(AggregationExpression expression) Create aDateOperators.Timezonefor theAggregationExpressionresulting in the Olson Timezone Identifier or UTC Offset.static DateOperators.TimezoneCreate aDateOperators.Timezonefor theFieldreference holding the Olson Timezone Identifier or UTC Offset.static DateOperators.TimezoneCreate aDateOperators.Timezonefor the given value which must be a valid expression that resolves to aStringrepresenting an Olson Timezone Identifier or UTC Offset.
-
Method Details
-
none
Return an emptyDateOperators.Timezone.- Returns:
- never null.
-
valueOf
Create aDateOperators.Timezonefor the given value which must be a valid expression that resolves to aStringrepresenting an Olson Timezone Identifier or UTC Offset.- Parameters:
value- the plain timezoneString, aFieldholding the timezone or anAggregationExpressionresulting in the timezone.- Returns:
- new instance of
DateOperators.Timezone.
-
fromOffset
Create aDateOperators.Timezonefor the givenTimeZonerendering the offset as UTC offset.- Parameters:
timeZone-TimeZonerendering the offset as UTC offset.- Returns:
- new instance of
DateOperators.Timezone. - Since:
- 3.3
-
fromOffset
Create aDateOperators.Timezonefor the givenZoneOffsetrendering the offset as UTC offset.- Parameters:
offset-ZoneOffsetrendering the offset as UTC offset.- Returns:
- new instance of
DateOperators.Timezone. - Since:
- 3.3
-
fromZone
Create aDateOperators.Timezonefor the givenTimeZonerendering the offset as UTC offset.- Parameters:
timeZone-DateOperators.Timezonerendering the offset as zone identifier.- Returns:
- new instance of
DateOperators.Timezone. - Since:
- 3.3
-
fromZone
Create aDateOperators.Timezonefor the givenZoneIdrendering the offset as UTC offset.- Parameters:
zoneId-ZoneIdrendering the offset as zone identifier.- Returns:
- new instance of
DateOperators.Timezone. - Since:
- 3.3
-
ofField
Create aDateOperators.Timezonefor theFieldreference holding the Olson Timezone Identifier or UTC Offset.- Parameters:
fieldReference- theFieldholding the timezone.- Returns:
- new instance of
DateOperators.Timezone.
-
ofExpression
Create aDateOperators.Timezonefor theAggregationExpressionresulting in the Olson Timezone Identifier or UTC Offset.- Parameters:
expression- theAggregationExpressionresulting in the timezone.- Returns:
- new instance of
DateOperators.Timezone.
-