Class DateToParts


  • public class DateToParts
    extends Expression
    Returns a document that contains the constituent parts of a given BSON Date value as individual properties. The properties returned are year, month, day, hour, minute, second and millisecond.
    Developer note.
    This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
    • Constructor Detail

      • DateToParts

        public DateToParts​(Expression date)
    • Method Detail

      • encode

        public void encode​(Mapper mapper,
                           org.bson.BsonWriter writer,
                           org.bson.codecs.EncoderContext encoderContext)
        Overrides:
        encode in class Expression
        Parameters:
        mapper - the mapper
        writer - the writer
        encoderContext - the context
      • iso8601

        public DateToParts iso8601​(boolean iso8601)
        Optional. If set to true, modifies the output document to use ISO week date fields. Defaults to false.
        Parameters:
        iso8601 - true to use ISO 8601
        Returns:
        this
      • timezone

        public DateToParts timezone​(Expression timezone)
        The optional timezone to use to format the date. By default, it uses UTC.
        Parameters:
        timezone - the expression
        Returns:
        this