Class DateDeltaExpression
- java.lang.Object
-
- dev.morphia.aggregation.expressions.impls.Expression
-
- dev.morphia.aggregation.expressions.impls.DateDeltaExpression
-
public class DateDeltaExpression extends Expression
Changes a Date object by a specified number of time units.- Since:
- 2.3
- Since server release
- 5.0
-
-
Constructor Summary
Constructors Constructor Description DateDeltaExpression(String operator, Expression startDate, long amount, TimeUnit unit)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidencode(Datastore datastore, BsonWriter writer, EncoderContext encoderContext)DateDeltaExpressiontimezone(Expression timezone)The timezone to carry out the operation.-
Methods inherited from class dev.morphia.aggregation.expressions.impls.Expression
getOperation, getValue, toString
-
-
-
-
Constructor Detail
-
DateDeltaExpression
@MorphiaInternal public DateDeltaExpression(String operator, Expression startDate, long amount, TimeUnit unit)
- Parameters:
operator-startDate-amount-unit-
Developer note.This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
-
Method Detail
-
encode
public void encode(Datastore datastore, BsonWriter writer, EncoderContext encoderContext)
- Overrides:
encodein classExpression- Parameters:
datastore- the datastorewriter- the writerencoderContext- the context
-
timezone
public DateDeltaExpression timezone(Expression timezone)
The timezone to carry out the operation.must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. - Parameters:
timezone- the timezone expression- Returns:
- this
- Since:
- 2.3
-
-