class OCI8::BindType::DateTime
you should use OCI8::BindType::Time.
If you are in the regions where daylight saving time is adopted,
OCI8::BindType.default_timezone = :utc
# or
OCI8::BindType.default_timezone = :local
The time zone can be changed as follows:
time zone, but by the OCI8::BindType.default_timezone
The retrieved value’s time zone is determined not by the session
when using Oracle 8.x client.
Oracle 9i. This class is available only to fetch or bind DATE
Timestamp data types and session time zone are new features in
=== Note for Oracle 8.x client
ALTER SESSION SET TIME_ZONE=‘-05:00’
It is changed by the following SQL.
The session time zone is same with local machine’s by default.
WITH LOCAL TIME ZONE</tt>.
if its data type is DATE
, TIMESTAMP
or TIMESTAMP<br>The retrieved value's time zone is determined by the session time zone<br><br>=== Note for default time zone<br><br>OCI8::BindType::Mapping[OCI8::SQLT_TIMESTAMP_LTZ] = OCI8::BindType::DateTime<br># Changes the mapping for TIMESTAMP WITH LOCAL TIME ZONE<br><br>OCI8::BindType::Mapping[OCI8::SQLT_TIMESTAMP_TZ] = OCI8::BindType::DateTime<br># Changes the mapping for TIMESTAMP WITH TIME ZONE<br><br>OCI8::BindType::Mapping[OCI8::SQLT_TIMESTAMP] = OCI8::BindType::DateTime<br># Changes the mapping for TIMESTAMP<br><br>OCI8::BindType::Mapping[OCI8::SQLT_DAT] = OCI8::BindType::DateTime<br># Changes the mapping for DATE<br><br>Otherwise, you can change the default mapping for all queries.<br><br>cursor.exec()<br>cursor.define(1, nil, DateTime)<br>cursor = conn.parse("SELECT hiredate FROM emp")<br><br>OCI8::Cursor#define as follows:<br>by default. You change the behaviour by explicitly calling<br>and <tt>TIMESTAMP WITH LOCAL TIME ZONE
are selected as a TimeDATE
, TIMESTAMP
, TIMESTAMP WITH TIME ZONE
=== How to select DataTime values.
is a DateTime.
and TIMESTAMP WITH LOCAL TIME ZONE
. The retrieved valueDATE
, TIMESTAMP
, TIMESTAMP WITH TIME ZONE
This is a helper class to select or bind Oracle data types such as
++
OCI8::BindType::DateTime
–
def get() # :nodoc:
def get() # :nodoc: array_to_datetime(super(), nil) end
def set(val) # :nodoc:
def set(val) # :nodoc: super(datetime_to_array(val, :timestamp_tz)) end