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
Time
instance 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
Time
instance 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
Array
value represented by givenYAML::Any
type, else raise aTypeCastError
exception. -
#to_array?(value_type : T.class = String) forall T
Returns the
Array
value represented by givenYAML::Any
type, else raise aTypeCastError
exception. - #to_bool
- #to_bool?
-
#to_float
Returns the
Float
value represented by givenYAML::Any
type, else raise aTypeCastError
exception. - #to_float32
- #to_float32?
- #to_float64
- #to_float64?
-
#to_float?
Returns the
Float
value represented by givenYAML::Any
type, else raise aTypeCastError
exception. -
#to_hash(value_type : T.class = String) forall T
Returns the
Hash
value represented by givenYAML::Any
type, else raise aTypeCastError
exception. -
#to_hash?(value_type : T.class = String) forall T
Returns the
Hash
value represented by givenYAML::Any
type, else raise aTypeCastError
exception. -
#to_int
Returns the
Int
value represented by givenYAML::Any
type, else raise aTypeCastError
exception. - #to_int16
- #to_int16?
- #to_int32
- #to_int32?
- #to_int64
- #to_int64?
- #to_int8
- #to_int8?
-
#to_int?
Returns the
Int
value represented by givenYAML::Any
type, else raise aTypeCastError
exception. -
#to_string
Alias to
Object.to_s
-
#to_time(location : Time::Location | Nil = nil, formatters : Array(String) | Nil = nil)
Returns the
Time
value represented by givenArray
type, else raise aTypeCastError
exception. - #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
Time
value represented by givenFloat
type, else raise aTypeCastError
exception. -
#to_time(location : Time::Location | Nil = nil, formatters : Array(String) | Nil = nil)
Returns the
Time
value represented by givenHash
type, else raise aTypeCastError
exception. -
#to_time(location : Time::Location | Nil = nil, formatters : Array(String) | Nil = nil)
Returns the
Time
value represented by givenInt
type, else raise aTypeCastError
exception. - #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
Time
value represented by givenArray
type, else raise aTypeCastError
exception. -
#to_time(location : Time::Location | Nil = nil, formatters : Array(String) | Nil = nil)
Returns the
Time
value represented by givenNil
type, else raise aTypeCastError
exception. - #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
Time
value represented by givenArray
type, else raise aTypeCastError
exception. - #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
Time
value represented by givenFloat
type, else raise aTypeCastError
exception. -
#to_time?(location : Time::Location | Nil = nil, formatters : Array(String) | Nil = nil)
Returns the
Time
value represented by givenHash
type, else raise aTypeCastError
exception. -
#to_time?(location : Time::Location | Nil = nil, formatters : Array(String) | Nil = nil)
Returns the
Time
value represented by givenInt
type, else raise aTypeCastError
exception. - #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
Time
value represented by givenArray
type, else raise aTypeCastError
exception. -
#to_time?(location : Time::Location | Nil = nil, formatters : Array(String) | Nil = nil)
Returns the
Time
value represented by givenNil
type, else raise aTypeCastError
exception. - #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
UInt
value represented by givenYAML::Any
type, else raise aTypeCastError
exception. - #to_uint16
- #to_uint16?
- #to_uint32
- #to_uint32?
- #to_uint64
- #to_uint64?
- #to_uint8
- #to_uint8?
-
#to_uint?
Returns the
UInt
value represented by givenYAML::Any
type, else raise aTypeCastError
exception.
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.