struct DuckDB::Timestamp
- DuckDB::Timestamp
- Struct
- Value
- Object
Defined in:
duckdb/timestamp.crConstructors
- .new(date : DuckDB::Date, time_of_day : DuckDB::TimeOfDay)
-
.new(time : Time)
Initializes a timestamp with a
Time
instance in UTC. - .new(string : String)
-
.new(microseconds : Int64)
Initialize with microseconds since
Time::UNIX_EPOCH
Instance Method Summary
- #==(other : self) : Bool
- #date : Date
- #day(*args, **options)
- #day(*args, **options, &)
- #hour(*args, **options)
- #hour(*args, **options, &)
- #microsecond(*args, **options)
- #microsecond(*args, **options, &)
- #millisecond(*args, **options)
- #millisecond(*args, **options, &)
- #minute(*args, **options)
- #minute(*args, **options, &)
- #month(*args, **options)
- #month(*args, **options, &)
- #second(*args, **options)
- #second(*args, **options, &)
- #submillisecond?(*args, **options)
- #submillisecond?(*args, **options, &)
- #subsecond?(*args, **options)
- #subsecond?(*args, **options, &)
- #time_of_day : TimeOfDay
-
#to_s
Returns the timestamp with an ISO 8601 format.
-
#to_time
Returns a
Time
instance with the respective timestamp in UTC. - #year(*args, **options)
- #year(*args, **options, &)
Constructor Detail
def self.new(time : Time)
#
Initializes a timestamp with a Time
instance in UTC.
It raises ArgumentError
if time
is not in UTC.
NOTE Beware the loss of precision in the fractional part (nanoseconds to microseconds)