Oracle® Data Provider for .NET Developer's Guide 11g Release 2 (11.2.0.3) Part Number E23174-02 |
|
|
PDF · Mobi · ePub |
The OracleTimeStampTZ
structure represents the Oracle TIMESTAMP
WITH
TIME
ZONE
data type to be stored in or retrieved from a database. Each OracleTimeStampTZ
stores the following information: year, month, day, hour, minute, second, nanosecond, and time zone.
System.Object
System.ValueType
Oracle.DataAccess.Types.OracleTimeStampTZ
// ADO.NET 2.0: C# public struct OracleTimeStampTZ : IComparable, INullable, IXmlSerializable
All public static methods are thread-safe, although instance methods do not guarantee thread safety.
// C# using System; using Oracle.DataAccess.Client; using Oracle.DataAccess.Types; class OracleTimeStampTZSample { static void Main() { // Set the nls parameters for the current thread OracleGlobalization info = OracleGlobalization.GetClientInfo(); info.TimeZone = "US/Eastern"; info.TimeStampFormat = "DD-MON-YYYY HH:MI:SS.FF AM"; info.TimeStampTZFormat = "DD-MON-YYYY HH:MI:SS.FF AM TZR"; OracleGlobalization.SetThreadInfo(info); // Create an OracleTimeStampTZ in US/Pacific time zone OracleTimeStampTZ tstz1=new OracleTimeStampTZ("11-NOV-1999 "+ "11:02:33.444 AM US/Pacific"); // Note that ToOracleTimeStampTZ uses the thread's time zone region, // "US/Eastern" OracleTimeStamp ts = new OracleTimeStamp("11-NOV-1999 11:02:33.444 AM"); OracleTimeStampTZ tstz2 = ts.ToOracleTimeStampTZ(); // Calculate the difference between tstz1 and tstz2 OracleIntervalDS idsDiff = tstz1.GetDaysBetween(tstz2); // Display information Console.WriteLine("tstz1.TimeZone = " + tstz1.TimeZone); // Prints "US/Pacific" Console.WriteLine("tstz2.TimeZone = " + tstz2.TimeZone); // Prints "US/Eastern" Console.WriteLine("idsDiff.Hours = " + idsDiff.Hours); // Prints 3 Console.WriteLine("idsDiff.Minutes = " + idsDiff.Minutes); // Prints 0 } }
Namespace: Oracle.DataAccess.Types
Assembly: Oracle.DataAccess.dll
ODP.NET Version: ODP.NET for .NET Framework 2.0 or ODP.NET for .NET Framework 4
See Also:
OracleTimeStampTZ
members are listed in the following tables:
OracleTimeStampTZ Constructors
OracleTimeStampTZ
constructors are listed in Table 14-113
Table 14-113 OracleTimeStampTZ Constructors
Constructor | Description |
---|---|
Instantiates a new instance of |
OracleTimeStampTZ Static Fields
The OracleTimeStampTZ
static fields are listed in Table 14-114.
Table 14-114 OracleTimeStampTZ Static Fields
Field | Description |
---|---|
Represents the maximum valid date for an |
|
Represents the minimum valid date for an |
|
Represents a null value that can be assigned to an instance of the |
OracleTimeStampTZ Static Methods
The OracleTimeStampTZ
static methods are listed in Table 14-115.
Table 14-115 OracleTimeStampTZ Static Methods
Methods | Description |
---|---|
Determines if two |
|
Gets an |
|
Determines if the first of two |
|
Determines if the first of two |
|
Determines if the first of two |
|
Determines if the first of two |
|
Determines if two |
|
Gets an |
|
Returns a new instance of an |
OracleTimeStampTZ Static Operators
The OracleTimeStampTZ
static operators are listed in Table 14-116.
Table 14-116 OracleTimeStampTZ Static Operators
Operator | Description |
---|---|
Adds the supplied instance value to the supplied |
|
Determines if two |
|
Determines if the first of two |
|
Determines if the first of two |
|
Determines if two |
|
Determines if the first of two |
|
Determines if the first of two |
|
Subtracts the supplied instance value from the supplied |
OracleTimeStampTZ Static Type Conversions
The OracleTimeStampTZ
static type conversions are listed in Table 14-117.
Table 14-117 OracleTimeStampTZ Static Type Conversions
Operator | Description |
---|---|
Converts an instance value to an |
|
Converts an instance value to an |
|
Converts an |
The OracleTimeStampTZ
properties are listed in Table 14-118.
Table 14-118 OracleTimeStampTZ Properties
Properties | Description |
---|---|
Returns an array of bytes that represents an Oracle |
|
Specifies the day component of an |
|
Indicates whether or not the current instance has a null value |
|
Specifies the hour component of an |
|
Specifies the millisecond component of an |
|
Specifies the minute component of an |
|
Specifies the month component of an |
|
Specifies the nanosecond component of an |
|
Specifies the second component of an |
|
Returns the time zone of the |
|
Returns the date and time that is stored in the |
|
Specifies the year component of an |
The OracleTimeStampTZ
methods are listed in Table 14-119.
Table 14-119 OracleTimeStampTZ Methods
Methods | Description |
---|---|
Adds the supplied number of days to the current instance |
|
Adds the supplied number of hours to the current instance |
|
Adds the supplied number of milliseconds to the current instance |
|
Adds the supplied number of minutes to the current instance |
|
Adds the supplied number of months to the current instance |
|
Adds the supplied number of nanoseconds to the current instance |
|
Adds the supplied number of seconds to the current instance |
|
Adds the supplied number of years to the current instance |
|
Compares the current |
|
Determines whether or not an object has the same date and time as the current |
|
Subtracts an |
|
Returns a hash code for the |
|
Gets the time zone information in hours and minutes of the current |
|
Subtracts an |
|
GetType |
Inherited from |
Converts the current |
|
Converts the current |
|
Converts the current |
|
Converts the current |
|
Converts the current |
|
Converts the current datetime to Coordinated Universal Time (UTC) |
The OracleTimeStampTZ
constructors create new instances of the OracleTimeStampTZ
structure.
This constructor creates a new instance of the OracleTimeStampTZ
structure and sets its value for date and time using the supplied DateTime
value.
OracleTimeStampTZ(DateTime, string)
This constructor creates a new instance of the OracleTimeStampTZ
structure and sets its value for date and time using the supplied DateTime
value and the supplied time zone data.
This constructor creates a new instance of the OracleTimeStampTZ
structure and sets its value for date and time using the supplied string.
OracleTimeStampTZ(int, int, int)
This constructor creates a new instance of the OracleTimeStampTZ
structure and sets its value for date and time using year, month, and day.
OracleTimeStampTZ(int, int, int, string)
This constructor creates a new instance of the OracleTimeStampTZ
structure and sets its value for date and time using year, month, day, and time zone data.
OracleTimeStampTZ(int, int, int, int, int, int)
This constructor creates a new instance of the OracleTimeStampTZ
structure and sets its value for date and time using year, month, day, hour, minute, and second.
OracleTimeStampTZ(int, int, int, int, int, int, string)
This constructor creates a new instance of the OracleTimeStampTZ
structure and sets its value for date and time using year, month, day, hour, minute, second, and time zone data.
OracleTimeStampTZ(int, int, int, int, int, int, double)
This constructor creates a new instance of the OracleTimeStampTZ
structure and sets its value for date and time using year, month, day, hour, minute, second, and millisecond.
OracleTimeStampTZ(int, int, int, int, int, int, double, string)
This constructor creates a new instance of the OracleTimeStampTZ
structure and sets its value for date and time using year, month, day, hour, minute, second, millisecond, and time zone data.
OracleTimeStampTZ(int, int, int, int, int, int, int)
This constructor creates a new instance of the OracleTimeStampTZ
structure and sets its value for date and time using year, month, day, hour, minute, second, and nanosecond.
OracleTimeStampTZ(int, int, int, int, int, int, int, string)
This constructor creates a new instance of the OracleTimeStampTZ
structure and sets its value for date and time using year, month, day, hour, minute, second, nanosecond, and time zone data.
This constructor creates a new instance of the OracleTimeStampTZ
structure and sets its value to the provided byte array, that represents the internal Oracle TIMESTAMP
WITH
TIME
ZONE
format.
This constructor creates a new instance of the OracleTimeStampTZ
structure and sets its value for date and time using the supplied DateTime
value.
// C#
public OracleTimeStampTZ (DateTime dt);
dt
The supplied DateTime
value.
The time zone is set to the OracleGlobalization.TimeZone
of the thread.
ArgumentException
- The dt
parameter cannot be used to construct a valid OracleTimeStampTZ
.
This constructor creates a new instance of the OracleTimeStampTZ
structure with the supplied DateTime
value and the time zone data.
// C# public OracleTimeStampTZ (DateTime value1, string timeZone);
value1
The supplied DateTime
value.
timeZone
The time zone data provided.
ArgumentException
- The argument values of the parameters cannot be used to construct a valid OracleTimeStampTZ
.
timeZone
can be either an hour offset, for example, 7:00, or a valid time zone region name that is provided in V$TIMEZONE_NAMES
, such as US/Pacific. Time zone abbreviations are not supported.
If time zone is null, the OracleGlobalization.TimeZone
of the thread is used.
Note:
PST is a time zone region name as well as a time zone abbreviation; therefore it is accepted byOracleTimeStampTZ
.This constructor creates a new instance of the OracleTimeStampTZ
structure and sets its value for date and time using the supplied string.
// C#
public OracleTimeStampTZ (string tsStr);
tsStr
A string that represents an Oracle TIMESTAMP
WITH
TIME
ZONE
.
ArgumentException
- The tsStr
is an invalid string representation of an Oracle TIMESTAMP
WITH
TIME
ZONE
or the tsStr
is not in the timestamp format specified by the OracleGlobalization
.TimeStampTZFormat
property of the thread.
ArgumentNullException
- The tsStr
value is null.
The names and abbreviations used for months and days are in the language specified by the DateLanguage
and Calendar
properties of the thread's OracleGlobalization
object. If any of the thread's globalization properties are set to null or an empty string, the client computer's settings are used.
// C# using System; using Oracle.DataAccess.Client; using Oracle.DataAccess.Types; class OracleTimeStampTZSample { static void Main() { OracleGlobalization info = OracleGlobalization.GetClientInfo(); info.TimeStampTZFormat = "DD-MON-YYYY HH:MI:SS.FF AM TZR"; OracleGlobalization.SetThreadInfo(info); // construct OracleTimeStampTZ from a string using the format specified. OracleTimeStampTZ tstz = new OracleTimeStampTZ("11-NOV-1999" + "11:02:33.444 AM US/Pacific"); // Set the nls_timestamp_tz_format for the ToString() method info.TimeStampTZFormat = "YYYY-MON-DD HH:MI:SS.FF AM TZR"; OracleGlobalization.SetThreadInfo(info); // Prints "1999-NOV-11 11:02:33.444000000 AM US/Pacific" Console.WriteLine(tstz.ToString()); } }
See Also:
Oracle Database SQL Reference for further information on date format elements
This constructor creates a new instance of the OracleTimeStampTZ
structure and sets its value for date and time using year, month, and day.
// C# public OracleTimeStampTZ(int year, int month, int day);
year
The year provided. Range of year
is (-4712 to 9999).
month
The month provided. Range of month
is (1 to 12).
day
The day provided. Range of day
is (1 to 31).
ArgumentOutOfRangeException
- The argument value for one or more of the parameters is out of the specified range.
ArgumentException
- The argument values of the parameters cannot be used to construct a valid OracleTimeStampTZ
(that is, the day is out of range for the month).
The time zone is set to the OracleGlobalization.TimeZone
of the thread.
This constructor creates a new instance of the OracleTimeStampTZ
structure and sets its value for date and time using year, month, day, and time zone data.
// C# public OracleTimeStampTZ(int year, int month, int day, string timeZone);
year
The year provided. Range of year
is (-4712 to 9999).
month
The month provided. Range of month
is (1 to 12).
day
The day provided. Range of day
is (1 to 31).
timeZone
The time zone data provided.
ArgumentOutOfRangeException
- The argument value for one or more of the parameters is out of the specified range.
ArgumentException
- The argument values of the parameters cannot be used to construct a valid OracleTimeStampTZ
(that is, the day is out of range for the month or the time zone is invalid).
timeZone
can be either an hour offset, for example, 7:00, or a valid time zone region name that is provided in V$TIMEZONE_NAMES
, such as US/Pacific. Time zone abbreviations are not supported.
If time zone is null, the OracleGlobalization.TimeZone
of the thread is used.
Note:
PST is a time zone region name as well as a time zone abbreviation; therefore it is accepted byOracleTimeStampTZ
.This constructor creates a new instance of the OracleTimeStampTZ
structure and sets its value for date and time using year, month, day, hour, minute, and second.
// C# public OracleTimeStampTZ(int year, int month, int day, int hour, int minute, int second);
year
The year provided. Range of year
is (-4712 to 9999).
month
The month provided. Range of month
is (1 to 12).
day
The day provided. Range of day
is (1 to 31).
hour
The hour provided. Range of hour
is (0 to 23).
minute
The minute provided. Range of minute
is (0 to 59).
second
The second provided. Range of second
is (0 to 59).
ArgumentOutOfRangeException
- The argument value for one or more of the parameters is out of the specified range.
ArgumentException
- The argument values of the parameters cannot be used to construct a valid OracleTimeStampTZ
(that is, the day is out of range for the month).
The time zone is set to the OracleGlobalization.TimeZone
of the thread.
This constructor creates a new instance of the OracleTimeStampTZ
structure and sets its value for date and time using year, month, day, hour, minute, second, and time zone data.
// C# public OracleTimeStampTZ (int year, int month, int day, int hour, int minute, int second, string timeZone);
year
The year provided. Range of year
is (-4712 to 9999).
month
The month provided. Range of month
is (1 to 12).
day
The day provided. Range of day
is (1 to 31).
hour
The hour provided. Range of hour
is (0 to 23).
minute
The minute provided. Range of minute
is (0 to 59).
second
The second provided. Range of second
is (0 to 59).
timeZone
The time zone data provided.
ArgumentOutOfRangeException
- The argument value for one or more of the parameters is out of the specified range.
ArgumentException
- The argument values of the parameters cannot be used to construct a valid OracleTimeStampTZ
(that is, the day is out of range of the month or the time zone is invalid).
timeZone
can be either an hour offset, for example, 7:00, or a valid time zone region name that is provided in V$TIMEZONE_NAMES
, such as US/Pacific. Time zone abbreviations are not supported.
If time zone is null, the OracleGlobalization.TimeZone
of the thread is used.
Note:
PST is a time zone region name as well as a time zone abbreviation; therefore it is accepted byOracleTimeStampTZ
.This constructor creates a new instance of the OracleTimeStampTZ
structure and sets its value for date and time using year, month, day, hour, minute, second, and millisecond.
// C# public OracleTimeStampTZ(int year, int month, int day, int hour, int minute, int second, double millisecond);
year
The year provided. Range of year
is (-4712 to 9999).
month
The month provided. Range of month
is (1 to 12).
day
The day provided. Range of day
is (1 to 31).
hour
The hour provided. Range of hour
is (0 to 23).
minute
The minute provided. Range of minute
is (0 to 59).
second
The second provided. Range of second
is (0 to 59).
millisecond
The millisecond provided. Range of millisecond
is (0 to 999.999999).
ArgumentOutOfRangeException
- The argument value for one or more of the parameters is out of the specified range.
ArgumentException
- The argument values of the parameters cannot be used to construct a valid OracleTimeStampTZ
(that is, the day is out of range for the month).
The time zone is set to the OracleGlobalization.TimeZone
of the thread.
This constructor creates a new instance of the OracleTimeStampTZ
structure and sets its value for date and time using year, month, day, hour, minute, second, millisecond, and time zone data.
// C# public OracleTimeStampTZ(int year, int month, int day, int hour, int minute, int second, double millisecond, string timeZone);
year
The year provided. Range of year
is (-4712 to 9999).
month
The month provided. Range of month
is (1 to 12).
day
The day provided. Range of day
is (1 to 31).
hour
The hour provided. Range of hour
is (0 to 23).
minute
The minute provided. Range of minute
is (0 to 59).
second
The second provided. Range of second
is (0 to 59).
millisecond
The millisecond provided. Range of millisecond
is (0 to 999.999999).
timeZone
The time zone data provided.
ArgumentOutOfRangeException
- The argument value for one or more of the parameters is out of the specified range.
ArgumentException
- The argument values of the parameters cannot be used to construct a valid OracleTimeStampTZ
(that is, the day is out of range for the month or the time zone is invalid).
timeZone
can be either an hour offset, for example, 7:00, or a valid time zone region name that is provided in V$TIMEZONE_NAMES
, such as US/Pacific. Time zone abbreviations are not supported.
If time zone is null, the OracleGlobalization.TimeZone
of the thread is used.
Note:
PST is a time zone region name as well as a time zone abbreviation; therefore it is accepted byOracleTimeStampTZ
.This constructor creates a new instance of the OracleTimeStampTZ
structure and sets its value for date and time using year, month, day, hour, minute, second, and nanosecond.
// C# public OracleTimeStampTZ(int year, int month, int day, int hour, int minute, int second, int nanosecond);
year
The year provided. Range of year
is (-4712 to 9999).
month
The month provided. Range of month
is (1 to 12).
day
The day provided. Range of day
is (1 to 31).
hour
The hour provided. Range of hour
is (0 to 23).
minute
The minute provided. Range of minute
is (0 to 59).
second
The second provided. Range of second
is (0 to 59).
nanosecond
The nanosecond provided. Range of nanosecond
is (0 to 999999999).
ArgumentOutOfRangeException
- The argument value for one or more of the parameters is out of the specified range.
ArgumentException
- The argument values of the parameters cannot be used to construct a valid OracleTimeStampTZ
(that is, the day is out of range for the month).
The time zone is set to the OracleGlobalization.TimeZone
of the thread.
This constructor creates a new instance of the OracleTimeStampTZ
structure and sets its value for date and time using year, month, day, hour, minute, second, nanosecond, and time zone data.
// C# public OracleTimeStampTZ(int year, int month, int day, int hour, int minute, int second, int nanosecond, string timeZone);
year
The year provided. Range of year
is (-4712 to 9999).
month
The month provided. Range of month
is (1 to 12).
day
The day provided. Range of day
is (1 to 31).
hour
The hour provided. Range of hour
is (0 to 23).
minute
The minute provided. Range of minute
is (0 to 59).
second
The second provided. Range of second
is (0 to 59).
nanosecond
The nanosecond provided. Range of nanosecond
is (0 to 999999999).
timeZone
The time zone data provided.
ArgumentOutOfRangeException
- The argument value for one or more of the parameters is out of the specified range.
ArgumentException
- The argument values of the parameters cannot be used to construct a valid OracleTimeStampTZ
(that is, the day is out of range for the month or the time zone is invalid).
timeZone
can be either an hour offset, for example, 7:00, or a valid time zone region name that is provided in V$TIMEZONE_NAMES
, such as US/Pacific. Time zone abbreviations are not supported.
If time zone is null, the OracleGlobalization.TimeZone
of the thread is used.
Note:
PST is a time zone region name as well as a time zone abbreviation; therefore it is accepted byOracleTimeStampTZ
.This constructor creates a new instance of the OracleTimeStampTZ
structure and sets its value to the provided byte array, that represents the internal Oracle TIMESTAMP
WITH
TIME
ZONE
format.
// C#
public OracleTimeStampLTZ (byte[] bytes);
bytes
The provided byte array that represents an Oracle TIMESTAMP
WITH
TIME
ZONE
in Oracle internal format.
ArgumentException
- bytes
is not in internal Oracle TIMESTAMP
WITH
TIME
ZONE
format or bytes
is not a valid Oracle TIMESTAMP
WITH
TIME
ZONE
.
ArgumentNullException
- bytes
is null.
The OracleTimeStampTZ
static fields are listed in Table 14-120.
Table 14-120 OracleTimeStampTZ Static Fields
Field | Description |
---|---|
Represents the maximum valid date for an |
|
Represents the minimum valid date for an |
|
Represents a null value that can be assigned to an instance of the |
This static field represents the maximum valid datetime time for an OracleTimeStampTZ
structure in UTC, which is December 31, 999923:59:59.999999999.
// C# public static readonly OracleTimeStampTZ MaxValue;
This static field represents the minimum valid datetime for an OracleTimeStampTZ
structure in UTC, which is January 1, -4712 0:0:0.
// C# public static readonly OracleTimeStampTZ MinValue;
This static field represents a null value that can be assigned to an instance of the OracleTimeStampTZ
structure.
// C# public static readonly OracleTimeStampTZ Null;
The OracleTimeStampTZ
static methods are listed in Table 14-121.
Table 14-121 OracleTimeStampTZ Static Methods
Methods | Description |
---|---|
Determines if two |
|
Gets an |
|
Determines if the first of two |
|
Determines if the first of two |
|
Determines if the first of two |
|
Determines if the first of two |
|
Determines if two |
|
Gets an |
|
Returns a new instance of an |
This static method determines if two OracleTimeStampTZ
values are equal.
// C# public static bool Equals(OracleTimeStampTZ value1, OracleTimeStampTZ value2);
value1
The first OracleTimeStampTZ
.
value2
The second OracleTimeStampTZ
.
Returns true
if two OracleTimeStampTZ
values are equal. Returns false
otherwise.
The following rules apply to the behavior of this method.
Any OracleTimeStampTZ
that has a value is greater than an OracleTimeStampTZ
that has a null value.
Two OracleTimeStampTZ
s that contain a null value are equal.
This static method gets an OracleTimeStampTZ
structure that represents the current date and time.
// C# public static OracleTimeStampTZ GetSysDate();
An OracleTimeStampTZ
structure that represents the current date and time.
This static method determines if the first of two OracleTimeStampTZ
values is greater than the second.
// C# public static bool GreaterThan(OracleTimeStampTZ value1, OracleTimeStampTZ value2);
value1
The first OracleTimeStampTZ
.
value2
The second OracleTimeStampTZ
.
Returns true
if the first of two OracleTimeStampTZ
values is greater than the second; otherwise, returns false
.
The following rules apply to the behavior of this method.
Any OracleTimeStampTZ
that has a value is greater than an OracleTimeStampTZ
that has a null value.
Two OracleTimeStampTZ
s that contain a null value are equal.
This static method determines if the first of two OracleTimeStampTZ
values is greater than or equal to the second.
// C# public static bool GreaterThanOrEqual(OracleTimeStampTZ value1, OracleTimeStampTZ value2);
value1
The first OracleTimeStampTZ
.
value2
The second OracleTimeStampTZ
.
Returns true
if the first of two OracleTimeStampTZ
values is greater than or equal to the second; otherwise, returns false
.
The following rules apply to the behavior of this method.
Any OracleTimeStampTZ
that has a value is greater than an OracleTimeStampTZ
that has a null value.
Two OracleTimeStampTZ
s that contain a null value are equal.
This static method determines if the first of two OracleTimeStampTZ
values is less than the second.
// C# public static bool LessThan(OracleTimeStampTZ value1, OracleTimeStampTZ value2);
value1
The first OracleTimeStampTZ
.
value2
The second OracleTimeStampTZ
.
Returns true
if the first of two OracleTimeStampTZ
values is less than the second. Returns false
otherwise.
The following rules apply to the behavior of this method.
Any OracleTimeStampTZ
that has a value is greater than an OracleTimeStampTZ
that has a null value.
Two OracleTimeStampTZ
s that contain a null value are equal.
This static method determines if the first of two OracleTimeStampTZ
values is less than or equal to the second.
// C# public static bool LessThanOrEqual(OracleTimeStampTZ value1, OracleTimeStampTZ value2);
value1
The first OracleTimeStampTZ
.
value2
The second OracleTimeStampTZ
.
Returns true
if the first of two OracleTimeStampTZ
values is less than or equal to the second. Returns false
otherwise.
The following rules apply to the behavior of this method.
Any OracleTimeStampTZ
that has a value is greater than an OracleTimeStampTZ
that has a null value.
Two OracleTimeStampTZ
s that contain a null value are equal.
This static method determines if two OracleTimeStampTZ
values are not equal.
// C# public static bool NotEquals(OracleTimeStampTZ value1, OracleTimeStampTZ value2);
value1
The first OracleTimeStampTZ
.
value2
The second OracleTimeStampTZ
.
Returns true
if two OracleTimeStampTZ
values are not equal. Returns false
otherwise.
The following rules apply to the behavior of this method.
Any OracleTimeStampTZ
that has a value is greater than an OracleTimeStampTZ
that has a null value.
Two OracleTimeStampTZ
s that contain a null value are equal.
This static method returns an OracleTimeStampTZ
structure and sets its value for date and time using the supplied string.
// C#
public static OracleTimeStampTZ Parse(string tsStr);
tsStr
A string that represents an Oracle TIMESTAMP
WITH
TIME
ZONE
.
An OracleTimeStampTZ
structure.
ArgumentException
- The tsStr
is an invalid string representation of an Oracle TIMESTAMP
WITH
TIME
ZONE
or the tsStr
is not in the timestamp format specified by the OracleGlobalization
.TimeStampTZFormat
property of the thread, which represents the Oracle NLS_TIMESTAMP_TZ_FORMAT
parameter.
ArgumentNullException
- The tsStr
value is null.
The names and abbreviations used for months and days are in the language specified by the DateLanguage
and Calendar
properties of the thread's OracleGlobalization
object. If any of the thread's globalization properties are set to null or an empty string, the client computer's settings are used.
// C# using System; using Oracle.DataAccess.Client; using Oracle.DataAccess.Types; class ParseSample { static void Main() { // Set the nls_timestamp_tz_format for the Parse() method OracleGlobalization info = OracleGlobalization.GetClientInfo(); info.TimeStampTZFormat = "DD-MON-YYYY HH:MI:SS.FF AM TZR"; OracleGlobalization.SetThreadInfo(info); // construct OracleTimeStampTZ from a string using the format specified. OracleTimeStampTZ tstz = OracleTimeStampTZ.Parse("11-NOV-1999 " + "11:02:33.444 AM US/Pacific"); // Set the nls_timestamp_tz_format for the ToString() method info.TimeStampTZFormat = "YYYY-MON-DD HH:MI:SS.FF AM TZR"; OracleGlobalization.SetThreadInfo(info); // Prints "1999-NOV-11 11:02:33.444000000 AM US/Pacific" Console.WriteLine(tstz.ToString()); } }
See Also:
This static method returns a new instance of an OracleTimeStampTZ
with the specified fractional second precision.
// C# public static OracleTimeStampTZ SetPrecision(OracleTimeStampTZ value1, int fracSecPrecision);
value1
The provided OracleTimeStampTZ
object.
fracSecPrecision
The fractional second precision provided. Range of fractional second precision is (0 to 9).
An OracleTimeStampTZ
structure with the specified fractional second precision
ArgumentOutOfRangeException
- fracSecPrecision
is out of the specified range.
The value specified in the supplied fracSecPrecision
is used to perform a rounding off operation on the supplied OracleTimeStampTZ
value. Depending on this value, 0
or more trailing zeros are displayed in the string returned by ToString()
.
The OracleTimeStampTZ
with a value of "December 31,
9999
23:59:59.99
US/Pacific
" results in the string "December
31,
9999 23:59:59.99000
US/Pacific
" when SetPrecision()
is called with the fractional second precision set to 5
.
The OracleTimeStampTZ
static operators are listed in Table 14-122.
Table 14-122 OracleTimeStampTZ Static Operators
Operator | Description |
---|---|
Adds the supplied instance value to the supplied |
|
Determines if two |
|
Determines if the first of two |
|
Determines if the first of two |
|
Determines if two |
|
Determines if the first of two |
|
Determines if the first of two |
|
Subtracts the supplied instance value from the supplied |
operator+
adds the supplied structure to the supplied OracleTimeStampTZ
and returns a new OracleTimeStampTZ
structure.
operator +(OracleTimeStampTZ, OracleIntervalDS)
This static operator adds the supplied OracleIntervalDS
to the supplied OracleTimeStampTZ
and returns a new OracleTimeStampTZ
structure.
operator +(OracleTimeStampTZ, OracleIntervalYM)
This static operator adds the supplied OracleIntervalYM
to the supplied OracleTimeStampTZ
and returns a new OracleTimeStampTZ
structure.
operator +(OracleTimeStampTZ, TimeSpan)
This static operator adds the supplied TimeSpan
to the supplied OracleTimeStampTZ
and returns a new OracleTimeStampTZ
structure.
This static operator adds the supplied OracleIntervalDS
to the supplied OracleTimeStampTZ
and returns a new OracleTimeStampTZ
structure.
// C# public static operator +(OracleTimeStampTZ value1, OracleIntervalDS value2);
value1
An OracleTimeStampTZ
.
value2
An OracleIntervalDS
.
An OracleTimeStampTZ
.
If either parameter has a null value, the returned OracleTimeStampTZ
has a null value.
This static operator adds the supplied OracleIntervalYM
to the supplied OracleTimeStampTZ
and returns a new OracleTimeStampTZ
structure.
// C# public static operator +(OracleTimeStampTZ value1, OracleIntervalYM value2);
value1
An OracleTimeStampTZ
.
value2
An OracleIntervalYM
.
An OracleTimeStampTZ
.
If either parameter has a null value, the returned OracleTimeStampTZ
has a null value.
This static operator adds the supplied TimeSpan
to the supplied OracleTimeStampTZ
and returns a new OracleTimeStampTZ
structure.
// C# public static operator +(OracleTimeStampTZ value1, TimeSpan value2);
value1
An OracleTimeStampTZ
.
value2
A TimeSpan.
An OracleTimeStampTZ
.
If the OracleTimeStampTZ
instance has a null value, the returned OracleTimeStampTZ
has a null value.
This static operator determines if two OracleTimeStampTZ
values are equal.
// C# public static bool operator == (OracleTimeStampTZ value1, OracleTimeStampTZ value2);
value1
The first OracleTimeStampTZ
.
value2
The second OracleTimeStampTZ.
Returns true
if they are equal; otherwise returns false
.
The following rules apply to the behavior of this method.
Any OracleTimeStampTZ
that has a value is greater than an OracleTimeStampTZ
that has a null value.
Two OracleTimeStampTZ
s that contain a null value are equal.
This static operator determines if the first of two OracleTimeStampTZ
values is greater than the second.
// C# public static bool operator > (OracleTimeStampTZ value1, OracleTimeStampTZ value2);
value1
The first OracleTimeStampTZ
.
value2
The second OracleTimeStampTZ
.
Returns true
if the first OracleTimeStampTZ
value is greater than the second; otherwise, returns false
.
The following rules apply to the behavior of this method.
Any OracleTimeStampTZ
that has a value is greater than an OracleTimeStampTZ
that has a null value.
Two OracleTimeStampTZ
s that contain a null value are equal.
This static operator determines if the first of two OracleTimeStampTZ
values is greater than or equal to the second.
// C# public static bool operator >= (OracleTimeStampTZ value1, OracleTimeStampTZ value2);
value1
The first OracleTimeStampTZ
.
value2
The second OracleTimeStampTZ
.
Returns true
if the first OracleTimeStampTZ
is greater than or equal to the second; otherwise, returns false
.
The following rules apply to the behavior of this method.
Any OracleTimeStampTZ
that has a value is greater than an OracleTimeStampTZ
that has a null value.
Two OracleTimeStampTZ
s that contain a null value are equal.
This static operator determines if two OracleTimeStampTZ
values are not equal.
// C# public static bool operator != (OracleTimeStampTZ value1, OracleTimeStampTZ value2);
value1
The first OracleTimeStampTZ
.
value2
The second OracleTimeStampTZ
.
Returns true
if two OracleTimeStampTZ
values are not equal; otherwise, returns false
.
The following rules apply to the behavior of this method.
Any OracleTimeStampTZ
that has a value is greater than an OracleTimeStampTZ
that has a null value.
Two OracleTimeStampTZ
s that contain a null value are equal.
This static operator determines if the first of two OracleTimeStampTZ
values is less than the second.
// C# public static bool operator < (OracleTimeStampTZ value1, OracleTimeStampTZ value2);
value1
The first OracleTimeStampTZ
.
value2
The second OracleTimeStampTZ
.
Returns true
if the first OracleTimeStampTZ
is less than the second; otherwise returns false
.
The following rules apply to the behavior of this method.
Any OracleTimeStampTZ
that has a value is greater than an OracleTimeStampTZ
that has a null value.
Two OracleTimeStampTZ
s that contain a null value are equal.
This static operator determines if the first of two OracleTimeStampTZ
values is less than or equal to the second.
// C# public static bool operator <= (OracleTimeStampTZ value1, OracleTimeStampTZ value2);
value1
The first OracleTimeStampTZ
.
value2
The second OracleTimeStampTZ
.
Returns true
if the first OracleTimeStampTZ
is less than or equal to the second; otherwise, returns false
.
The following rules apply to the behavior of this method.
Any OracleTimeStampTZ
that has a value is greater than an OracleTimeStampTZ
that has a null value.
Two OracleTimeStampTZ
s that contain a null value are equal.
operator-
subtracts the supplied value, from the supplied OracleTimeStampTZ
value, and returns a new OracleTimeStampTZ
structure.
operator - (OracleTimeStampTZ, OracleIntervalDS)
This static operator subtracts the supplied OracleIntervalDS
value, from the supplied OracleTimeStampTZ
value, and return a new OracleTimeStampTZ
structure.
operator - (OracleTimeStampTZ, OracleIntervalYM)
This static operator subtracts the supplied OracleIntervalYM
value, from the supplied OracleTimeStampTZ
value, and returns a new OracleTimeStampTZ
structure.
operator - (OracleTimeStampTZ value1, TimeSpan value2)
This static operator subtracts the supplied TimeSpan
value, from the supplied OracleTimeStampTZ
value, and returns a new OracleTimeStampTZ
structure.
This static operator subtracts the supplied OracleIntervalDS
value, from the supplied OracleTimeStampTZ
value, and return a new OracleTimeStampTZ
structure.
// C# public static operator - (OracleTimeStampTZ value1, OracleIntervalDS value2);
value1
An OracleTimeStampTZ
.
value2
An OracleIntervalDS
.
An OracleTimeStampTZ
structure.
If either parameter has a null value, the returned OracleTimeStampTZ
has a null value.
This static operator subtracts the supplied OracleIntervalYM
value, from the supplied OracleTimeStampTZ
value, and returns a new OracleTimeStampTZ
structure.
// C# public static operator - (OracleTimeStampTZ value1, OracleIntervalYM value2);
value1
An OracleTimeStampTZ
.
value2
An OracleIntervalYM
.
An OracleTimeStampTZ
structure.
If either parameter has a null value, the returned OracleTimeStampTZ
has a null value.
This static operator subtracts the supplied TimeSpan
value, from the supplied OracleTimeStampTZ
value, and returns a new OracleTimeStampTZ
structure.
// C# public static operator - (OracleTimeStampTZ value1, TimeSpan value2);
value1
An OracleTimeStampTZ
.
value2
A TimeSpan
.
An OracleTimeStampTZ
structure.
If the OracleTimeStampTZ
instance has a null value, the returned OracleTimeStampTZ
structure has a null value.
The OracleTimeStampTZ
static type conversions are listed in Table 14-123.
Table 14-123 OracleTimeStampTZ Static Type Conversions
Operator | Description |
---|---|
Converts an instance value to an |
|
Converts an instance value to an |
|
Converts an |
explicit operator OracleTimeStampTZ
converts an instance value to an OracleTimeStampTZ
structure.
explicit operator OracleTimeStampTZ(OracleTimeStamp)
This static type conversion operator converts an OracleTimeStamp
value to an OracleTimeStampTZ
structure.
explicit operator OracleTimeStampTZ(OracleTimeStampLTZ)
This static type conversion operator converts an OracleTimeStampLTZ
value to an OracleTimeStampTZ
structure.
explicit operator OracleTimeStampTZ(string)
This static type conversion operator converts the supplied string value to an OracleTimeStampTZ
structure.
See Also:
This static type conversion operator converts an OracleTimeStamp
value to an OracleTimeStampTZ
structure.
// C# public static explicit operator OracleTimeStampTZ(OracleTimeStamp value1);
value1
An OracleTimeStamp
.
The returned OracleTimeStampTZ
contains the date and time from the OracleTimeStamp
and the time zone from the OracleGlobalization.TimeZone
of the thread.
The OracleGlobalization.TimeZone
of the thread is used to convert from an OracleTimeStamp
structure to an OracleTimeStampTZ
structure.
If the OracleTimeStamp
structure has a null value, the returned OracleTimeStampTZ
structure also has a null value.
See Also:
This static type conversion operator converts an OracleTimeStampLTZ
value to an OracleTimeStampTZ
structure.
// C#
public static explicit operator OracleTimeStampTZ(OracleTimeStampLTZ value1);
value1
An OracleTimeStampLTZ
.
The returned OracleTimeStampTZ
contains the date and time from the OracleTimeStampLTZ
and the time zone from the OracleGlobalization.TimeZone
of the thread.
If the OracleTimeStampLTZ
structure has a null value, the returned OracleTimeStampTZ
structure also has a null value.
See Also:
This static type conversion operator converts the supplied string value to an OracleTimeStampTZ
structure.
// C#
public static explicit operator OracleTimeStampTZ(string tsStr);
tsStr
A string representation of an Oracle TIMESTAMP
WITH
TIME
ZONE
.
An OracleTimeStampTZ
value.
ArgumentException
- The tsStr
is an invalid string representation of an Oracle TIMESTAMP
WITH
TIME
ZONE
. or the tsStr
is not in the timestamp format specified by the thread's OracleGlobalization
.TimeStampTZFormat
property, which represents the Oracle NLS_TIMESTAMP_TZ_FORMAT
parameter.
The names and abbreviations used for months and days are in the language specified by the DateLanguage
and Calendar
properties of the thread's OracleGlobalization
object. If any of the thread's globalization properties are set to null or an empty string, the client computer's settings are used.
// C# using System; using Oracle.DataAccess.Client; using Oracle.DataAccess.Types; class OracleTimeStampTZSample { static void Main() { // Set the nls_timestamp_tz_format for the explicit operator // OracleTimeStampTZ(string) OracleGlobalization info = OracleGlobalization.GetClientInfo(); info.TimeStampTZFormat = "DD-MON-YYYY HH:MI:SS.FF AM TZR"; OracleGlobalization.SetThreadInfo(info); // construct OracleTimeStampTZ from a string using the format specified. OracleTimeStampTZ tstz = new OracleTimeStampTZ("11-NOV-1999" + "11:02:33.444 AM US/Pacific"); // Set the nls_timestamp_tz_format for the ToString() method info.TimeStampTZFormat = "YYYY-MON-DD HH:MI:SS.FF AM TZR"; OracleGlobalization.SetThreadInfo(info); Console.WriteLine(tstz.ToString()); } }
See Also:
implicit operator OracleTimeStampTZ
converts a DateTime
structure to an OracleTimeStampTZ
structure.
implicit operator OracleTimeStampTZ(OracleDate)
This static type conversion operator converts an OracleDate
value to an OracleTimeStampTZ
structure.
implicit operator OracleTimeStampTZ(DateTime)
This static type conversion operator converts a DateTime
structure to an OracleTimeStampTZ
structure.
See Also:
This static type conversion operator converts an OracleDate
value to an OracleTimeStampTZ
structure.
// C#
public static implicit operator OracleTimeStampTZ(OracleDate value1);
value1
An OracleDate
.
The returned OracleTimeStampTZ
contains the date and time from the OracleDate
and the time zone from the OracleGlobalization.TimeZone
of the thread.
The OracleGlobalization.TimeZone
of the thread is used to convert from an OracleDate
to an OracleTimeStampTZ
structure. If the OracleDate
structure has a null value, the returned OracleTimeStampTZ
structure also has a null value.
See Also:
This static type conversion operator converts a DateTime
structure to an OracleTimeStampTZ
structure.
// C#
public static implicit operator OracleTimeStampTZ (DateTime value1);
value1
A DateTime
structure.
The returned OracleTimeStampTZ
contains the date and time from the DateTime
and the time zone from the OracleGlobalization.TimeZone
of the thread.
The OracleGlobalization.TimeZone
of the thread is used to convert from a DateTime
to an Oracle TimeStampTZ
structure.
See Also:
This static type conversion operator converts an OracleTimeStampTZ
value to a DateTime
structure and truncates the time zone information.
// C#
public static explicit operator DateTime(OracleTimeStampTZ value1);
value1
An OracleTimeStampTZ
.
A DateTime
containing the date and time in the current instance, but with the time zone information in the current instance truncated.
OracleNullValueException
- The OracleTimeStampTZ
structure has a null value.
The precision of the OracleTimeStampTZ
value can be lost during the conversion, and the time zone information in the current instance is truncated
The OracleTimeStampTZ
properties are listed in Table 14-124.
Table 14-124 OracleTimeStampTZ Properties
Properties | Description |
---|---|
Returns an array of bytes that represents an Oracle |
|
Specifies the day component of an |
|
Indicates whether or not the current instance has a null value |
|
Specifies the hour component of an |
|
Specifies the millisecond component of an |
|
Specifies the minute component of an |
|
Specifies the month component of an |
|
Specifies the nanosecond component of an |
|
Specifies the second component of an |
|
Returns the time zone of the |
|
Returns the date and time that is stored in the |
|
Specifies the year component of an |
This property returns an array of bytes that represents an Oracle TIMESTAMP
WITH
TIME
ZONE
in Oracle internal format.
// C# public byte[] BinData {get;}
The provided byte array that represents an Oracle TIMESTAMP
WITH
TIME
ZONE
in Oracle internal format.
OracleNullValueException
- The current instance has a null value.
This property specifies the day component of an OracleTimeStampTZ
in the current time zone.
// C# public int Day{get;}
A number that represents the day. Range of Day
is (1 to 31).
OracleNullValueException
- The current instance has a null value.
This property indicates whether or not the current instance has a null value.
// C# public bool IsNull{get;}
Returns true
if the current instance has a null value. Otherwise, returns false
.
This property specifies the hour component of an OracleTimeStampTZ
in the current time zone.
// C# public int Hour{get;}
A number that represents the hour. Range of Hour
is (0 to 23).
OracleNullValueException
- The current instance has a null value.
This property gets the millisecond component of an OracleTimeStampTZ
in the current time zone.
// C# public double Millisecond{get;}
A number that represents a millisecond. Range of Millisecond
is (0 to 999.999999)
OracleNullValueException
- The current instance has a null value.
This property gets the minute component of an OracleTimeStampTZ
in the current time zone.
// C# public int Minute{get;}
A number that represent a minute. Range of Minute
is (0 to 59).
OracleNullValueException
- The current instance has a null value.
This property gets the month component of an OracleTimeStampTZ
in the current time zone
// C# public int Month{get;}
A number that represents a month. Range of Month
is (1 to 12).
OracleNullValueException
- The current instance has a null value.
This property gets the nanosecond component of an OracleTimeStampTZ
in the current time zone.
// C# public int Nanosecond{get;}
A number that represents a nanosecond. Range of Nanosecond
is (0 to 999999999).
OracleNullValueException
- The current instance has a null value.
This property gets the second component of an OracleTimeStampTZ
in the current time zone.
// C# public int Second{get;}
A number that represents a second. Range of Second
is (0 to 59).
OracleNullValueException
- The current instance has a null value.
This property returns the time zone of the OracleTimeStampTZ
instance.
// C# public string TimeZone{get;}
A string that represents the time zone.
If no time zone is specified in the constructor, this property is set to the thread's OracleGlobalization
.TimeZone
by default
See Also:
This property returns the date and time that is stored in the OracleTimeStampTZ
structure in the current time zone.
// C# public DateTime Value{get;}
A DateTime
in the current time zone.
OracleNullValueException
- The current instance has a null value.
This property sets the year component of an OracleTimeStampTZ
in the current time zone.
// C# public int Year{get;}
A number that represents a year. The range of Year
is (-4712 to 9999).
OracleNullValueException
- The current instance has a null value.
The OracleTimeStampTZ
methods are listed in Table 14-125.
Table 14-125 OracleTimeStampTZ Methods
Methods | Description |
---|---|
Adds the supplied number of days to the current instance |
|
Adds the supplied number of hours to the current instance |
|
Adds the supplied number of milliseconds to the current instance |
|
Adds the supplied number of minutes to the current instance |
|
Adds the supplied number of months to the current instance |
|
Adds the supplied number of nanoseconds to the current instance |
|
Adds the supplied number of seconds to the current instance |
|
Adds the supplied number of years to the current instance |
|
Compares the current |
|
Determines whether or not an object has the same date and time as the current |
|
Subtracts an |
|
Returns a hash code for the |
|
Gets the time zone information in hours and minutes of the current |
|
Subtracts an |
|
GetType |
Inherited from |
Converts the current |
|
Converts the current |
|
Converts the current |
|
Converts the current |
|
Converts the current |
|
Converts the current datetime to Coordinated Universal Time (UTC) |
This method adds the supplied number of days to the current instance.
// C#
public OracleTimeStampTZ AddDays(double days);
days
The supplied number of days. Range is (-1,000,000,000 < days
< 1,000,000,000)
An OracleTimeStampTZ
.
OracleNullValueException
- The current instance has a null value.
ArgumentOutofRangeException
- The argument value is out of the specified range.
This method adds the supplied number of hours to the current instance.
// C#
public OracleTimeStampTZ AddHours(double hours);
hours
The supplied number of hours. Range is (-24,000,000,000 < hours
< 24,000,000,000).
An OracleTimeStampTZ
.
OracleNullValueException
- The current instance has a null value.
ArgumentOutofRangeException
- The argument value is out of the specified range.
This method adds the supplied number of milliseconds to the current instance.
// C#
public OracleTimeStampTZ AddMilliseconds(double milliseconds);
milliseconds
The supplied number of milliseconds. Range is (-8.64 * 1016< milliseconds
< 8.64 * 1016).
An OracleTimeStampTZ
.
OracleNullValueException
- The current instance has a null value.
ArgumentOutofRangeException
- The argument value is out of the specified range.
This method adds the supplied number of minutes to the current instance.
// C#
public OracleTimeStampTZ AddMinutes(double minutes);
minutes
The supplied number of minutes. Range is (-1,440,000,000,000 < minutes
< 1,440,000,000,000).
An OracleTimeStampTZ
.
OracleNullValueException
- The current instance has a null value.
ArgumentOutofRangeException
- The argument value is out of the specified range.
This method adds the supplied number of months to the current instance.
// C#
public OracleTimeStampTZ AddMonths(long months);
months
The supplied number of months. Range is (-12,000,000,000 < months
< 12,000,000,000).
An OracleTimeStampTZ
.
OracleNullValueException
- The current instance has a null value.
ArgumentOutofRangeException
- The argument value is out of the specified range.
This method adds the supplied number of nanoseconds to the current instance.
// C#
public OracleTimeStampTZ AddNanoseconds(long nanoseconds);
nanoseconds
The supplied number of nanoseconds.
An OracleTimeStampTZ
.
OracleNullValueException
- The current instance has a null value.
This method adds the supplied number of seconds to the current instance.
// C#
public OracleTimeStampTZ AddSeconds(double seconds);
seconds
The supplied number of seconds. Range is (-8.64 * 1013< seconds
< 8.64 * 1013).
An OracleTimeStampTZ
.
OracleNullValueException
- The current instance has a null value.
ArgumentOutofRangeException
- The argument value is out of the specified range.
This method adds the supplied number of years to the current instance
// C#
public OracleTimeStampTZ AddYears(int years);
years
The supplied number of years. Range is (-999,999,999 <= years
< = 999,999,999).
An OracleTimeStampTZ
.
OracleNullValueException
- The current instance has a null value.
ArgumentOutofRangeException
- The argument value is out of the specified range.
This method compares the current OracleTimeStampTZ
instance to an object, and returns an integer that represents their relative values.
// C#
public int CompareTo(object obj);
obj
The object being compared to the current OracleTimeStampTZ
instance.
The method returns a number that is:
Less than zero: if the current OracleTimeStampTZ
instance value is less than that of obj
.
Zero: if the current OracleTimeStampTZ
instance and obj
values are equal.
Greater than zero: if the current OracleTimeStampTZ
instance value is greater than that of obj
.
IComparable
ArgumentException
- The obj
is not of type OracleTimeStampTZ
.
The following rules apply to the behavior of this method.
The comparison must be between OracleTimeStampTZ
s. For example, comparing an OracleTimeStampTZ
instance with an OracleBinary
instance is not allowed. When an OracleTimeStampTZ
is compared with a different type, an ArgumentException
is thrown.
Any OracleTimeStampTZ
that has a value is greater than an OracleTimeStampTZ
that has a null value.
Two OracleTimeStampTZ
s that contain a null value are equal.
Overrides Object
This method determines whether or not an object has the same date and time as the current OracleTimeStampTZ
instance.
// C#
public override bool Equals(object obj);
obj
The object being compared to the current OracleTimeStampTZ
instance.
Returns true
if the obj
is of type OracleTimeStampTZ
and represents the same date and time; otherwise, returns false
.
The following rules apply to the behavior of this method.
Any OracleTimeStampTZ
that has a value is greater than an OracleTimeStampTZ
that has a null value.
Two OracleTimeStampTZ
s that contain a null value are equal.
This method subtracts an OracleTimeStampTZ
value from the current instance and returns an OracleIntervalDS
that represents the time interval.
// C#
public OracleIntervalDS GetDaysBetween(OracleTimeStampTZ value1);
value1
The OracleTimeStampTZ
value being subtracted.
An OracleIntervalDS
that represents the interval between two OracleTimeStampTZ
values.
If either the current instance or the parameter has a null value, the returned OracleIntervalDS
has a null value.
Overrides Object
This method returns a hash code for the OracleTimeStampTZ
instance.
// C# public override int GetHashCode();
A number that represents the hash code.
This method gets the time zone portion in hours and minutes of the current OracleTimeStampTZ
.
// C# public TimeSpan GetTimeZoneOffset();
A TimeSpan
.
OracleNullValueException
- The current instance has a null value.
This method subtracts an OracleTimeStampTZ
value from the current instance and returns an OracleIntervalYM
that represents the time interval.
// C#
public OracleIntervalYM GetYearsBetween(OracleTimeStampTZ val);
val
The OracleTimeStampTZ
value being subtracted.
An OracleIntervalYM
that represents the interval between two OracleTimeStampTZ
values.
If either the current instance or the parameter has a null value, the returned OracleIntervalYM
has a null value.
This method converts the current OracleTimeStampTZ
instance to local time.
// C# public OracleTimeStampLTZ ToLocalTime();
An OracleTimeStampLTZ
that contains the date and time, which is normalized to the client local time zone, in the current instance.
If the current instance has a null value, the returned OracleTimeStampLTZ
has a null value.
This method converts the current OracleTimeStampTZ
structure to an OracleDate
structure.
// C# public OracleDate ToOracleDate();
The returned OracleDate
contains the date and time in the current instance, but the time zone information in the current instance is truncated
The precision of the OracleTimeStampTZ
value can be lost during the conversion, and the time zone information in the current instance is truncated.
If the current instance has a null value, the value of the returned OracleDate
structure has a null value.
This method converts the current OracleTimeStampTZ
structure to an OracleTimeStampLTZ
structure.
// C# public OracleTimeStampLTZ ToOracleTimeStampLTZ();
The returned OracleTimeStampLTZ
structure contains the date and time, which is normalized to the client local time zone, in the current instance.
If the value of the current instance has a null value, the value of the returned OracleTimeStampLTZ
structure has a null value.
This method converts the current OracleTimeStampTZ
structure to an OracleTimeStamp
structure.
// C# public OracleTimeStamp ToOracleTimeStamp();
The returned OracleTimeStamp
contains the date and time in the current instance, but the time zone information is truncated.
If the value of the current instance has a null value, the value of the returned OracleTimeStamp
structure has a null value.
Overrides Object
This method converts the current OracleTimeStampTZ
structure to a string.
// C# public override string ToString();
A string
that represents the same date and time as the current OracleTimeStampTZ
structure.
The returned value is a string representation of an OracleTimeStampTZ
in the format specified by the OracleGlobalization
.TimeStampTZFormat
property of the thread. The names and abbreviations used for months and days are in the language specified by the OracleGlobalization
.DateLanguage
and the OracleGlobalization.Calendar
properties of the thread. If any of the thread's globalization properties are set to null or an empty string, the client computer's settings are used.
// C# using System; using Oracle.DataAccess.Client; using Oracle.DataAccess.Types; class ToStringSample { static void Main() { // Set the nls parameters for the current thread OracleGlobalization info = OracleGlobalization.GetClientInfo(); info.TimeZone = "US/Eastern"; info.TimeStampFormat = "DD-MON-YYYY HH:MI:SS.FF AM"; info.TimeStampTZFormat = "DD-MON-YYYY HH:MI:SS.FF AM TZR"; OracleGlobalization.SetThreadInfo(info); // Create an OracleTimeStampTZ in US/Pacific time zone OracleTimeStampTZ tstz1=new OracleTimeStampTZ("11-NOV-1999 "+ "11:02:33.444 AM US/Pacific"); // Note that ToOracleTimeStampTZ uses the thread's time zone region, // "US/Eastern" OracleTimeStamp ts = new OracleTimeStamp("11-NOV-1999 11:02:33.444 AM"); OracleTimeStampTZ tstz2 = ts.ToOracleTimeStampTZ(); // Calculate the difference between tstz1 and tstz2 OracleIntervalDS idsDiff = tstz1.GetDaysBetween(tstz2); // Prints "US/Pacific" Console.WriteLine("tstz1.TimeZone = " + tstz1.TimeZone); // Prints "US/Eastern" Console.WriteLine("tstz2.TimeZone = " + tstz2.TimeZone); // Prints 3 Console.WriteLine("idsDiff.Hours = " + idsDiff.Hours); // Prints 0 Console.WriteLine("idsDiff.Minutes = " + idsDiff.Minutes); } }
See Also:
This method converts the current datetime to Coordinated Universal Time (UTC).
// C# public OracleTimeStampTZ ToUniversalTime();
An OracleTimeStampTZ
structure.
If the current instance has a null value, the value of the returned OracleTimeStampTZ
structure has a null value.