struct Time
- Time
- Struct
- Value
- Object
Overview
Time cast methods
Included Modules
- Comparable(Time)
- Steppable
Defined in:
popcorn/cast/int.crConstructors
-
.unix(seconds : Int, location = Location::UTC) : Time
Creates a new
Timeinstance that corresponds to the number of seconds elapsed since the Unix epoch (1970-01-01 00:00:00 UTC). -
.unix_ms(milliseconds : Int, location = Location::UTC) : Time
Creates a new
Timeinstance that corresponds to the number of milliseconds elapsed since the Unix epoch (1970-01-01 00:00:00 UTC).
Instance Method Summary
- #cast(other)
- #cast?(other)
-
#to_array(value_type : T.class = String) forall T
Returns the
Arrayvalue represented by givenYAML::Anytype, else raise aTypeCastErrorexception. -
#to_array?(value_type : T.class = String) forall T
Returns the
Arrayvalue represented by givenYAML::Anytype, else raise aTypeCastErrorexception. - #to_bool
- #to_bool?
-
#to_float
Returns the
Floatvalue represented by givenYAML::Anytype, else raise aTypeCastErrorexception. - #to_float32
- #to_float32?
- #to_float64
- #to_float64?
-
#to_float?
Returns the
Floatvalue represented by givenYAML::Anytype, else raise aTypeCastErrorexception. -
#to_hash(value_type : T.class = String) forall T
Returns the
Hashvalue represented by givenYAML::Anytype, else raise aTypeCastErrorexception. -
#to_hash?(value_type : T.class = String) forall T
Returns the
Hashvalue represented by givenYAML::Anytype, else raise aTypeCastErrorexception. -
#to_int
Returns the
Intvalue represented by givenYAML::Anytype, else raise aTypeCastErrorexception. - #to_int16
- #to_int16?
- #to_int32
- #to_int32?
- #to_int64
- #to_int64?
- #to_int8
- #to_int8?
-
#to_int?
Returns the
Intvalue represented by givenYAML::Anytype, else raise aTypeCastErrorexception. -
#to_string
Alias to
Object.to_s -
#to_time(location : Time::Location | Nil = nil, formatters : Array(String) | Nil = nil)
Returns the
Timevalue represented by givenArraytype, else raise aTypeCastErrorexception. - #to_time(location : Time::Location | Nil = nil, formatters : Array(String) | Nil = nil)
-
#to_time(location : Time::Location | Nil = nil, formatters : Array(String) | Nil = nil)
Returns the
Timevalue represented by givenFloattype, else raise aTypeCastErrorexception. -
#to_time(location : Time::Location | Nil = nil, formatters : Array(String) | Nil = nil)
Returns the
Timevalue represented by givenHashtype, else raise aTypeCastErrorexception. -
#to_time(location : Time::Location | Nil = nil, formatters : Array(String) | Nil = nil)
Returns the
Timevalue represented by givenInttype, else raise aTypeCastErrorexception. - #to_time(location : Time::Location | Nil = nil, formatters : Array(String) | Nil = nil)
-
#to_time(location : Time::Location | Nil = nil, formatters : Array(String) | Nil = nil)
Returns the
Timevalue represented by givenArraytype, else raise aTypeCastErrorexception. -
#to_time(location : Time::Location | Nil = nil, formatters : Array(String) | Nil = nil)
Returns the
Timevalue represented by givenNiltype, else raise aTypeCastErrorexception. - #to_time(location : Time::Location | Nil = nil, formatters : Array(String) | Nil = nil)
- #to_time(location : Time::Location | Nil = nil, formatters : Array(String) | Nil = nil)
- #to_time(location : Time::Location | Nil = nil, formatters : Array(String) | Nil = nil)
- #to_time(location : Time::Location | Nil = nil, formatters : Array(String) | Nil = nil)
-
#to_time?(location : Time::Location | Nil = nil, formatters : Array(String) | Nil = nil)
Returns the
Timevalue represented by givenArraytype, else raise aTypeCastErrorexception. - #to_time?(location : Time::Location | Nil = nil, formatters : Array(String) | Nil = nil)
-
#to_time?(location : Time::Location | Nil = nil, formatters : Array(String) | Nil = nil)
Returns the
Timevalue represented by givenFloattype, else raise aTypeCastErrorexception. -
#to_time?(location : Time::Location | Nil = nil, formatters : Array(String) | Nil = nil)
Returns the
Timevalue represented by givenHashtype, else raise aTypeCastErrorexception. -
#to_time?(location : Time::Location | Nil = nil, formatters : Array(String) | Nil = nil)
Returns the
Timevalue represented by givenInttype, else raise aTypeCastErrorexception. - #to_time?(location : Time::Location | Nil = nil, formatters : Array(String) | Nil = nil)
-
#to_time?(location : Time::Location | Nil = nil, formatters : Array(String) | Nil = nil)
Returns the
Timevalue represented by givenArraytype, else raise aTypeCastErrorexception. -
#to_time?(location : Time::Location | Nil = nil, formatters : Array(String) | Nil = nil)
Returns the
Timevalue represented by givenNiltype, else raise aTypeCastErrorexception. - #to_time?(location : Time::Location | Nil = nil, formatters : Array(String) | Nil = nil)
- #to_time?(location : Time::Location | Nil = nil, formatters : Array(String) | Nil = nil)
- #to_time?(location : Time::Location | Nil = nil, formatters : Array(String) | Nil = nil)
- #to_time?(location : Time::Location | Nil = nil, formatters : Array(String) | Nil = nil)
-
#to_uint
Returns the
UIntvalue represented by givenYAML::Anytype, else raise aTypeCastErrorexception. - #to_uint16
- #to_uint16?
- #to_uint32
- #to_uint32?
- #to_uint64
- #to_uint64?
- #to_uint8
- #to_uint8?
-
#to_uint?
Returns the
UIntvalue represented by givenYAML::Anytype, else raise aTypeCastErrorexception.
Constructor Detail
Creates a new Time instance that corresponds to the number of
seconds elapsed since the Unix epoch (1970-01-01 00:00:00 UTC).
The time zone is always UTC.
Time.unix(981173106) # => 2001-02-03 04:05:06 UTC
Creates a new Time instance that corresponds to the number of
milliseconds elapsed since the Unix epoch (1970-01-01 00:00:00 UTC).
The time zone is always UTC.
time = Time.unix_ms(981173106789) # => 2001-02-03 04:05:06.789 UTC
time.millisecond # => 789
Instance Method Detail
Returns the Float value represented by given YAML::Any type, else raise a TypeCastError exception.
Returns the Float32 value represented by given YAML::Any type, else raise a TypeCastError exception.
Returns the Float32 value represented by given YAML::Any type, else raise a TypeCastError exception.
Returns the Float64 value represented by given YAML::Any type, else raise a TypeCastError exception.
Returns the Float64 value represented by given YAML::Any type, else raise a TypeCastError exception.
Returns the Float value represented by given YAML::Any type, else raise a TypeCastError exception.
Returns the Int value represented by given YAML::Any type, else raise a TypeCastError exception.
Returns the Int value represented by given YAML::Any type, else raise a TypeCastError exception.
Returns the UInt value represented by given YAML::Any type, else raise a TypeCastError exception.