Package org.jruby
Class RubyTime
java.lang.Object
org.jruby.RubyBasicObject
org.jruby.RubyObject
org.jruby.RubyTime
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparable<IRubyObject>
,InstanceVariables
,InternalVariables
,IRubyObject
,CoreObjectType
The Time class.
- Author:
- chadfowler, jpetersen
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.jruby.RubyObject
RubyObject.Data
Nested classes/interfaces inherited from class org.jruby.RubyBasicObject
RubyBasicObject.Finalizer
-
Field Summary
FieldsFields inherited from class org.jruby.RubyObject
IVAR_INSPECTING_OBJECT_ALLOCATOR, OBJECT_ALLOCATOR, REIFYING_OBJECT_ALLOCATOR
Fields inherited from class org.jruby.RubyBasicObject
ALL_F, BASICOBJECT_ALLOCATOR, COMPARE_BY_IDENTITY_F, ERR_INSECURE_SET_INST_VAR, FALSE_F, FL_USHIFT, flags, FROZEN_F, IS_OVERLAID_F, metaClass, NEVER, NIL_F, REFINED_MODULE_F, STAMP_OFFSET, TAINTED_F, UNDEF, USER0_F, USER1_F, USER2_F, USER3_F, USER4_F, USER5_F, USER6_F, USER7_F, USER8_F, USER9_F, USERA_F, VAR_TABLE_OFFSET, varTable, varTableStamp
Fields inherited from interface org.jruby.runtime.builtin.IRubyObject
NULL_ARRAY
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionasctime()
static IRubyObject
at
(ThreadContext context, IRubyObject recv, IRubyObject arg) static IRubyObject
at
(ThreadContext context, IRubyObject recv, IRubyObject[] args) static IRubyObject
at
(ThreadContext context, IRubyObject recv, IRubyObject arg1, IRubyObject arg2) static IRubyObject
at
(ThreadContext context, IRubyObject recv, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3) ceil
(ThreadContext context, IRubyObject[] args) static double
convertTimeInterval
(ThreadContext context, IRubyObject sec) static RubyClass
createTimeClass
(ThreadContext context, RubyClass Object, RubyModule Comparable) dump
(IRubyObject[] args, Block unusedBlock) Deprecated.dump
(ThreadContext context) dump
(ThreadContext context, IRubyObject arg) eql_p
(ThreadContext context, IRubyObject otherArg) floor
(ThreadContext context, IRubyObject[] args) friday_p
(ThreadContext context) org.joda.time.DateTime
int
getDay()
static String
getEnvTimeZone
(Ruby runtime) Deprecated.static String
getEnvTimeZone
(ThreadContext context) getgm()
int
getHour()
Class
<?> Will return the Java interface that most closely can represent this object, when working through Java integration translations.final RubyTime
getlocal()
getlocal
(ThreadContext context) getlocal
(ThreadContext context, IRubyObject off) static org.joda.time.DateTimeZone
getLocalTimeZone
(Ruby runtime) Deprecated.static org.joda.time.DateTimeZone
getLocalTimeZone
(ThreadContext context) int
Return the micro-seconds of this time.int
int
getMonth()
int
getNanos()
Return the nano-seconds of this time.This is overridden in the other concrete Java builtins to provide a fast way to determine what type they are.long
getNSec()
Get the nano-second (only) part of the time.static String
getRubyTimeZoneName
(String envTZ, org.joda.time.DateTime dt) static String
getRubyTimeZoneName
(Ruby runtime, org.joda.time.DateTime dt) Deprecated.static String
getRubyTimeZoneName
(ThreadContext context, org.joda.time.DateTime dt) int
long
long
static org.joda.time.DateTimeZone
getTimeZone
(Ruby runtime, long seconds) Deprecated.static org.joda.time.DateTimeZone
getTimeZone
(ThreadContext context, long seconds) static org.joda.time.DateTimeZone
getTimeZoneFromString
(Ruby runtime, String zone) Deprecated.static org.joda.time.DateTimeZone
getTimeZoneFromTZString
(Ruby runtime, String zone) Deprecated.static org.joda.time.DateTimeZone
getTimeZoneFromTZString
(ThreadContext context, String zone) static org.joda.time.DateTimeZone
getTimeZoneFromUtcOffset
(ThreadContext context, IRubyObject arg) static org.joda.time.DateTimeZone
getTimeZoneWithOffset
(Ruby runtime, String zoneName, int offset) Deprecated.static org.joda.time.DateTimeZone
getTimeZoneWithOffset
(ThreadContext context, String zoneName, int offset) long
getUSec()
Get the micro-second (only) part of the time.int
getYear()
Deprecated.gmt()
Deprecated.gmt
(ThreadContext context) Deprecated.gmt_offset
(ThreadContext context) gmtime()
Deprecated.gmtime
(ThreadContext context) hash
(ThreadContext context) Will return the hash code of this object.int
hashCode()
This override does not do "checked" dispatch since Object usually has #hash defined.hour()
Deprecated.hour
(ThreadContext context) initialize
(ThreadContext context) initialize
(ThreadContext context, IRubyObject[] args) initialize
(ThreadContext context, IRubyObject year, IRubyObject month, IRubyObject day, IRubyObject hour, IRubyObject minute, IRubyObject second, IRubyObject usec, IRubyObject zone) initialize_copy
(ThreadContext context, IRubyObject original) Initializes this object as a copy of the original, that is the parameter to this object.inspect
(ThreadContext context) Returns a string containing a human-readable representation of obj.static RaiseException
invalidUTCOffset
(Ruby runtime) Deprecated.UseinvalidUTCOffset(ThreadContext)
insteadstatic RaiseException
invalidUTCOffset
(Ruby runtime, IRubyObject value) Deprecated.UseinvalidUTCOffset(ThreadContext)
insteadstatic RaiseException
invalidUTCOffset
(ThreadContext context) static RaiseException
invalidUTCOffset
(ThreadContext context, IRubyObject value) isdst()
Deprecated.isdst
(ThreadContext context) boolean
isUTC()
static RubyTime
load
(IRubyObject recv, IRubyObject from, Block block) Deprecated.static RubyTime
load
(ThreadContext context, IRubyObject recv, IRubyObject from) static RubyTime
local
(ThreadContext context, IRubyObject recv, IRubyObject[] args) final RubyTime
localtime
(ThreadContext context) localtime
(ThreadContext context, IRubyObject arg) mday()
Deprecated.mday
(ThreadContext context) mdump()
Deprecated.long
Deprecated.usegetMicros()
insteadmin()
Deprecated.min
(ThreadContext context) monday_p
(ThreadContext context) month()
Deprecated.month
(ThreadContext context) static RubyTime
newInstance
(ThreadContext context, IRubyObject recv, IRubyObject[] args) static IRubyObject
newInstance
(ThreadContext context, IRubyObject recv, IRubyObject[] args, Block block) Deprecated.static RubyTime
static RubyTime
static RubyTime
Create new (Ruby) Time instance.static RubyTime
newTimeFromNanoseconds
(Ruby runtime, long nanoseconds) Deprecated.static RubyTime
newTimeFromNanoseconds
(ThreadContext context, long nanoseconds) nsec()
Deprecated.nsec
(ThreadContext context) Get the fractional part of time in nanoseconds.op_cmp
(ThreadContext context, IRubyObject other) op_eqq
(ThreadContext context, IRubyObject other) rb_equal The Ruby "===" method is used by default in case/when statements.op_equal
(ThreadContext context, IRubyObject other) rb_obj_equal Will by default use identity equality to compare objects.op_ge
(ThreadContext context, IRubyObject other) op_gt
(ThreadContext context, IRubyObject other) op_le
(ThreadContext context, IRubyObject other) op_lt
(ThreadContext context, IRubyObject other) op_minus
(IRubyObject other) op_minus
(ThreadContext context, IRubyObject other) op_plus
(IRubyObject other) op_plus
(ThreadContext context, IRubyObject other) round
(ThreadContext context, IRubyObject[] args) static IRubyObject
s_new
(IRubyObject recv, IRubyObject[] args, Block block) Deprecated.saturday_p
(ThreadContext context) sec()
Deprecated.sec
(ThreadContext context) void
setDateTime
(org.joda.time.DateTime dt) void
setMicros
(int micros) Sets the microsecond part for this Time object.void
setMicroseconds
(long micros) Deprecated.usesetMicros(int)
insteadvoid
setNanos
(int nanos) Sets the nanosecond part for this Time object.void
setNSec
(long nsec) Set the nano-second (only) part for this time.void
setUSec
(long usec) Set the micro-second (only) part of the time.void
setZoneObject
(IRubyObject zone) strftime
(IRubyObject format) Deprecated.strftime
(ThreadContext context, IRubyObject format) subsec()
Deprecated.subsec
(ThreadContext context) sunday_p
(ThreadContext context) thursday_p
(ThreadContext context) static RubyTime
timeZoneLocal
(ThreadContext context, IRubyObject off, RubyTime time) to_a
(ThreadContext context) to_f()
to_i()
Deprecated.to_i
(ThreadContext context) long
to_r
(ThreadContext context) to_s
(ThreadContext context) <T> T
Convert the object to the specified Java class, if possible.toString()
The default toString method is just a wrapper that calls the Ruby "to_s" method.tuesday_p
(ThreadContext context) void
updateCal
(org.joda.time.DateTime dt) Deprecated.usec()
Deprecated.usec
(ThreadContext context) Get the microsecond part of this time value.static RubyTime
utc
(ThreadContext context, IRubyObject recv, IRubyObject[] args) wday()
Deprecated.wday
(ThreadContext context) wednesday_p
(ThreadContext context) yday()
Deprecated.yday
(ThreadContext context) year()
Deprecated.year
(ThreadContext context) zone()
Deprecated.Usezone(ThreadContext)
instead.zone
(ThreadContext context) static boolean
zoneLocalTime
(ThreadContext context, IRubyObject zone, RubyTime time) static boolean
zoneTimeLocal
(ThreadContext context, IRubyObject zone, RubyTime time) Methods inherited from class org.jruby.RubyObject
attachToObjectSpace, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, convertToType, dig, dig1, dig2, eqlInternal, equalInternal, equals, finishObjectClass, inspect, puts, specificEval, toRubyString
Methods inherited from class org.jruby.RubyBasicObject
addFinalizer, addFinalizer, anyToString, asJavaString, asString, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callSuper, checkArrayType, checkCallMethod, checkCallMethod, checkFrozen, checkStringType, cloneSetup, compareTo, convertToArray, convertToFloat, convertToHash, convertToInteger, convertToInteger, convertToInteger, convertToString, copyInstanceVariablesInto, copySpecialInstanceVariables, dataGetStruct, dataGetStructChecked, dataWrapStruct, decode, display, dup, dupFinalizer, dupSetup, ensureInstanceVariablesSettable, eql, eql_p, equal_p, evalUnder, extend, fastGetInstanceVariable, fastGetInternalVariable, fastHasInstanceVariable, fastHasInternalVariable, fastSetInstanceVariable, fastSetInternalVariable, finishBasicObjectClass, forEachInstanceVariable, forEachInstanceVariableName, freeze, frozen_p, getCurrentContext, getFFIHandle, getFlag, getInstanceEvalClass, getInstanceEvalClass, getInstanceVariable, getInstanceVariableList, getInstanceVariableNameList, getInstanceVariables, getInternalVariable, getInternalVariables, getMarshalVariableList, getMetaClass, getMetaClass, getNativeHandle, getNativeTypeIndex, getObjectId, getRuntime, getSingletonClass, getSingletonClassClone, getSingletonClassCloneAndAttach, getSingletonClassCloneAndAttach, getType, getVariable, getVariableCount, getVariableList, getVariableNameList, hash, hashyInspect, hasInstanceVariable, hasInstanceVariables, hasInternalVariable, hasVariables, id, infectBy, initialize_copy, inspect, inspectHashCode, instance_eval, instance_eval, instance_eval, instance_eval, instance_eval, instance_exec, instance_of_p, instance_variable_defined_p, instance_variable_get, instance_variable_set, instance_variables, isBuiltin, isClass, isFalse, isFrozen, isImmediate, isModule, isNil, isSpecialConst, isSpecialObject, isTaint, isTrue, isUntrusted, kind_of_p, makeMetaClass, makeMetaClass, makeMetaClassBootstrap, method, method, method, method_missing, methods, methods, nil_p, nonFixnumHashCode, nonFixnumHashCode, OBJ_INIT_COPY, objInitCopy, op_match, op_not, op_not_equal, op_not_match, private_methods, protected_methods, public_methods, rbClone, rbClone, rbInspect, remove_instance_variable, removeFinalizers, removeInstanceVariable, removeInternalVariable, respond_to_p, respond_to_p, respondsTo, respondsToMissing, respondsToMissing, send, send, send, send, send, setFFIHandle, setFlag, setFrozen, setInstanceVariable, setInternalVariable, setMetaClass, setNativeHandle, setTaint, setUntrusted, setVariable, singleton_method, singleton_method, singleton_method_added, singleton_method_removed, singleton_method_undefined, singleton_methods, singletonClass, specificEval, specificEval, specificEval, specificEval, syncVariables, syncVariables, taint, taint, tainted_p, testFrozen, testFrozen, to_a, to_s, trust, type, untaint, untrust, untrusted_p, validateInstanceVariable, validateInstanceVariable, validateInstanceVariable, variableTableContains, variableTableFastContains, variableTableFastFetch, variableTableFastStore, variableTableFetch, variableTableRemove, variableTableStore, variableTableSync, yieldUnder, yieldUnder
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.jruby.runtime.builtin.IRubyObject
checkStringType19, dup, marshalLiveVariables
-
Field Details
-
UTC
- See Also:
-
TIME_SCALE
public static final int TIME_SCALE- See Also:
-
-
Constructor Details
-
RubyTime
-
RubyTime
-
RubyTime
-
-
Method Details
-
getNativeClassIndex
Description copied from class:RubyObject
This is overridden in the other concrete Java builtins to provide a fast way to determine what type they are. Will generally return a value from org.jruby.runtime.ClassIndex- Specified by:
getNativeClassIndex
in interfaceCoreObjectType
- Overrides:
getNativeClassIndex
in classRubyObject
- Returns:
- the ClassIndex of the native type this object was constructed from
- See Also:
-
getEnvTimeZone
Deprecated. -
getEnvTimeZone
-
getLocalTimeZone
Deprecated. -
getLocalTimeZone
-
getTimeZoneFromTZString
@Deprecated(since="10.0") public static org.joda.time.DateTimeZone getTimeZoneFromTZString(Ruby runtime, String zone) Deprecated. -
getTimeZoneFromTZString
public static org.joda.time.DateTimeZone getTimeZoneFromTZString(ThreadContext context, String zone) -
getTimeZoneFromString
@Deprecated public static org.joda.time.DateTimeZone getTimeZoneFromString(Ruby runtime, String zone) Deprecated. -
getTimeZoneFromUtcOffset
public static org.joda.time.DateTimeZone getTimeZoneFromUtcOffset(ThreadContext context, IRubyObject arg) -
invalidUTCOffset
Deprecated.UseinvalidUTCOffset(ThreadContext)
instead- Parameters:
runtime
-- Returns:
- ""
-
invalidUTCOffset
-
invalidUTCOffset
@Deprecated(since="10.0") public static RaiseException invalidUTCOffset(Ruby runtime, IRubyObject value) Deprecated.UseinvalidUTCOffset(ThreadContext)
instead- Parameters:
runtime
-- Returns:
- ""
-
invalidUTCOffset
-
getTimeZone
@Deprecated(since="10.0") public static org.joda.time.DateTimeZone getTimeZone(Ruby runtime, long seconds) Deprecated. -
getTimeZone
-
getTimeZoneWithOffset
@Deprecated(since="10.0") public static org.joda.time.DateTimeZone getTimeZoneWithOffset(Ruby runtime, String zoneName, int offset) Deprecated. -
getTimeZoneWithOffset
public static org.joda.time.DateTimeZone getTimeZoneWithOffset(ThreadContext context, String zoneName, int offset) -
createTimeClass
public static RubyClass createTimeClass(ThreadContext context, RubyClass Object, RubyModule Comparable) -
setNSec
public void setNSec(long nsec) Set the nano-second (only) part for this time. Note thatnsec
means the 4 to 9 decimal places of sec fractional part of time. For example, 123456 fornsec
means.000123456
, not.123456000
.- Parameters:
nsec
- the nano second part only (4 to 9 decimal places) of time
-
getNSec
public long getNSec()Get the nano-second (only) part of the time. Note that it returns the 4 to 9 decimal places, not the entire sec fraction part till nano. For example for an epoch second1500000000.123456789
returns456789
.- Returns:
- the nano second part (only) of time
-
setUSec
public void setUSec(long usec) Set the micro-second (only) part of the time.- Parameters:
usec
-- See Also:
-
getUSec
public long getUSec()Get the micro-second (only) part of the time.- Returns:
- the micro-second only part of this time
- See Also:
-
setZoneObject
-
updateCal
Deprecated.UsesetDateTime(DateTime)
instead. -
newTime
-
newTimeFromNanoseconds
@Deprecated(since="10.0") public static RubyTime newTimeFromNanoseconds(Ruby runtime, long nanoseconds) Deprecated. -
newTimeFromNanoseconds
-
newTime
-
newTime
Create new (Ruby) Time instance. Note thatdt
oforg.joda.time.DateTime
represents the integer part and the fraction part to milliseconds, andnsec
the nano part (4 to 9 decimal places). For example,RubyTime.newTime(rt, new DateTime(987000), 345678)
creates an epoch second of987.000345678
, not987000.345678
.- Parameters:
runtime
- the runtimedt
- the integer part of time + the fraction part in millisecondsnsec
- the nanos only party of the time (millis excluded)- Returns:
- the new Time
- See Also:
-
initialize_copy
Description copied from class:RubyBasicObject
Initializes this object as a copy of the original, that is the parameter to this object. Will make sure that the argument actually has the same real class as this object. It shouldn't be possible to initialize an object with something totally different.- Overrides:
initialize_copy
in classRubyBasicObject
- Parameters:
context
- the thread contextoriginal
- the original- Returns:
- a copy unless the same thing
-
gmtime
Deprecated. -
gmtime
-
localtime
-
localtime
-
localtime
-
gmt
-
gmt
Deprecated. -
isUTC
public boolean isUTC() -
getgm
-
getlocal
-
getlocal
-
getlocal
-
strftime
Deprecated. -
strftime
-
op_equal
Description copied from class:RubyBasicObject
rb_obj_equal Will by default use identity equality to compare objects. This follows the Ruby semantics. The name of this method doesn't follow the convention because hierarchy problems- Specified by:
op_equal
in interfaceIRubyObject
- Overrides:
op_equal
in classRubyBasicObject
-
op_ge
-
op_gt
-
op_le
-
op_lt
-
op_plus
-
op_plus
-
op_minus
-
op_minus
-
op_eqq
Description copied from class:RubyObject
rb_equal The Ruby "===" method is used by default in case/when statements. The Object implementation first checks Java identity equality and then calls the "==" method too.- Specified by:
op_eqq
in interfaceIRubyObject
- Overrides:
op_eqq
in classRubyObject
-
op_cmp
- Overrides:
op_cmp
in classRubyBasicObject
-
eql_p
- Overrides:
eql_p
in classRubyBasicObject
-
asctime
-
to_s
- Overrides:
to_s
in classRubyBasicObject
-
inspect
Description copied from class:RubyBasicObject
Returns a string containing a human-readable representation of obj. If not overridden, uses theto_s
method to generate the string. [ 1, 2, 3..4, 'five' ].inspect #=> "[1, 2, 3..4, \"five\"]" Time.new.inspect #=> "Wed Apr 09 08:54:39 CDT 2003"- Specified by:
inspect
in interfaceIRubyObject
- Overrides:
inspect
in classRubyBasicObject
-
toString
Description copied from class:RubyObject
The default toString method is just a wrapper that calls the Ruby "to_s" method.- Overrides:
toString
in classRubyObject
- Returns:
- string representation
-
to_a
- Overrides:
to_a
in classRubyBasicObject
-
to_f
-
to_i
-
to_i_long
public long to_i_long() -
to_i
Deprecated. -
nsec
Get the fractional part of time in nanoseconds. Note that this returns the entire fraction part of the time in nanosecond, unlikeRubyTime#getNSec
. This method represents Ruby'snsec
method.- Returns:
- the (sec) fractional part of time (in nanos)
-
nsec
Deprecated. -
to_r
-
usec
Get the microsecond part of this time value.- Returns:
- the (whole) microsecond part of time
-
usec
Deprecated. -
getTimeInMicros
public long getTimeInMicros()- Returns:
- the total time in microseconds
- See Also:
-
getMicros
public int getMicros()Return the micro-seconds of this time.- Returns:
- micro seconds (only)
- See Also:
-
setMicros
public void setMicros(int micros) Sets the microsecond part for this Time object.- Parameters:
micros
- the microseconds to be set- See Also:
-
setMicroseconds
Deprecated.usesetMicros(int)
instead -
microseconds
Deprecated.usegetMicros()
instead -
getNanos
public int getNanos()Return the nano-seconds of this time.- Returns:
- nano seconds (only)
-
setNanos
public void setNanos(int nanos) Sets the nanosecond part for this Time object.- Parameters:
nanos
- the nanoseconds to be set- See Also:
-
sec
-
sec
Deprecated. -
min
-
min
Deprecated. -
hour
-
hour
Deprecated. -
mday
-
mday
Deprecated. -
month
-
month
Deprecated. -
year
-
year
Deprecated. -
wday
-
wday
Deprecated. -
yday
-
yday
Deprecated. -
sunday_p
-
monday_p
-
tuesday_p
-
wednesday_p
-
thursday_p
-
friday_p
-
saturday_p
-
subsec
Deprecated. -
subsec
-
gmt_offset
-
gmt_offset
Deprecated. -
isdst
-
isdst
Deprecated. -
zone
Deprecated.Usezone(ThreadContext)
instead.- Returns:
- ""
-
zone
-
getZoneName
Deprecated. -
getRubyTimeZoneName
@Deprecated(since="10.0") public static String getRubyTimeZoneName(Ruby runtime, org.joda.time.DateTime dt) Deprecated.UsegetRubyTimeZoneName(ThreadContext, DateTime)
instead.- Parameters:
runtime
-dt
-- Returns:
- ""
-
getRubyTimeZoneName
-
getRubyTimeZoneName
-
setDateTime
public void setDateTime(org.joda.time.DateTime dt) -
getDateTime
public org.joda.time.DateTime getDateTime() -
hash
Description copied from class:RubyBasicObject
Will return the hash code of this object. In comparison to MRI, this method will use the Java identity hash code instead of using rb_obj_id, since the usage of id in JRuby will incur the cost of some. ObjectSpace maintenance.- Overrides:
hash
in classRubyBasicObject
- Parameters:
context
- the current thread context- Returns:
- the hash value
-
hashCode
public int hashCode()Description copied from class:RubyObject
This override does not do "checked" dispatch since Object usually has #hash defined.- Overrides:
hashCode
in classRubyObject
- Returns:
- the hash code
- See Also:
-
dump
-
dump
-
dump
Deprecated. -
mdump
Deprecated. -
round
-
floor
-
ceil
-
s_new
Deprecated. -
newInstance
@Deprecated public static IRubyObject newInstance(ThreadContext context, IRubyObject recv, IRubyObject[] args, Block block) Deprecated. -
newInstance
-
at
-
at
public static IRubyObject at(ThreadContext context, IRubyObject recv, IRubyObject arg1, IRubyObject arg2) -
at
public static IRubyObject at(ThreadContext context, IRubyObject recv, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3) -
at
-
local
-
initialize
- Overrides:
initialize
in classRubyBasicObject
-
initialize
-
initialize
public IRubyObject initialize(ThreadContext context, IRubyObject year, IRubyObject month, IRubyObject day, IRubyObject hour, IRubyObject minute, IRubyObject second, IRubyObject usec, IRubyObject zone) -
utc
-
load
Deprecated. -
load
-
getJavaClass
Description copied from class:RubyBasicObject
Will return the Java interface that most closely can represent this object, when working through Java integration translations.- Specified by:
getJavaClass
in interfaceIRubyObject
- Overrides:
getJavaClass
in classRubyBasicObject
- Returns:
- the true Java class of this (Ruby) object
-
toJava
Description copied from interface:IRubyObject
Convert the object to the specified Java class, if possible.- Specified by:
toJava
in interfaceIRubyObject
- Overrides:
toJava
in classRubyBasicObject
- Type Parameters:
T
- type- Parameters:
target
- The target type to which the object should be converted.- Returns:
- java type
- See Also:
-
getTimeInMillis
public long getTimeInMillis()- Returns:
- millis since epoch this (date-time) value represents
- Since:
- 9.2 (public)
-
getYear
public int getYear()- Returns:
- year
- Since:
- 9.2
-
getMonth
public int getMonth()- Returns:
- month-of-year (1..12)
- Since:
- 9.2
-
getDay
public int getDay()- Returns:
- day-of-month
- Since:
- 9.2
-
getHour
public int getHour()- Returns:
- hour-of-day (0..23)
- Since:
- 9.2
-
getMinute
public int getMinute()- Returns:
- minute-of-hour
- Since:
- 9.2
-
getSecond
public int getSecond()- Returns:
- second-of-minute
- Since:
- 9.2
-
getJavaDate
- Returns:
- a Java (legacy) Date instance
- Since:
- 1.7
-
toInstant
- Returns:
- an instant
- Since:
- 9.2
-
toLocalDateTime
- Returns:
- a date time
- Since:
- 9.2
-
toZonedDateTime
- Returns:
- a date time
- Since:
- 9.2
-
toOffsetDateTime
- Returns:
- a date time
- Since:
- 9.2
-
convertTimeInterval
-
zoneTimeLocal
-
zoneLocalTime
-
timeZoneLocal
-
getRubyTimeZoneName(ThreadContext, DateTime)
instead.