Module: BSON::DateTime

Defined in:
lib/bson/date_time.rb

Overview

Injects behaviour for encoding date time values to raw bytes as specified by the BSON spec for time.

See Also:

Since:

  • 2.1.0

Instance Method Summary collapse

Instance Method Details

#to_bson(buffer = ByteBuffer.new) ⇒ BSON::ByteBuffer

Get the date time as encoded BSON.

Examples:

Get the date time as encoded BSON.

DateTime.new(2012, 1, 1, 0, 0, 0).to_bson

Returns:

See Also:

Since:

  • 2.1.0



39
40
41
# File 'lib/bson/date_time.rb', line 39

def to_bson(buffer = ByteBuffer.new)
  gregorian.to_time.to_bson(buffer)
end