The OracleTimeStampTZ structure represents the Oracle TIMESTAMP WITH TIME ZONE datatype 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.
Class Inheritance
Object
ValueType
OracleTimeStampTZ
Declaration
// C# public struct OracleTimeStampTZ : IComparable
Thread Safety
All public static methods are thread-safe, although instance methods do not guarantee thread safety.
Example
// 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
}
}
Requirements
Namespace: Oracle.DataAccess.Types
Assembly: Oracle.DataAccess.dll
OracleTimeStampTZ members are listed in the following tables:
OracleTimeStampTZ Constructors
OracleTimeStampTZ constructors are listed in Table 11-113
Table 11-113 OracleTimeStampTZ Constructors
| Constructor | Description |
|---|---|
| OracleTimeStampTZ Constructors | Instantiates a new instance of OracleTimeStampTZ structure (Overloaded) |
OracleTimeStampTZ Static Fields
The OracleTimeStampTZ static fields are listed in Table 11-114.
Table 11-114 OracleTimeStampTZ Static Fields
| Field | Description |
|---|---|
| MaxValue | Represents the maximum valid date for an OracleTimeStampTZ structure in UTC, which is December 31, 999923:59:59.999999999 |
| MinValue | Represents the minimum valid date for an OracleTimeStampTZ structure in UTC, which is January 1, -4712 0:0:0 |
| Null | Represents a null value that can be assigned to an instance of the OracleTimeStampTZ structure |
OracleTimeStampTZ Static Methods
The OracleTimeStampTZ static methods are listed in Table 11-115.
Table 11-115 OracleTimeStampTZ Static Methods
| Methods | Description |
|---|---|
| Equals | Determines if two OracleTimeStampTZ values are equal (Overloaded) |
| GetSysDate | Gets an OracleTimeStampTZ structure that represents the current date and time |
| GreaterThan | Determines if the first of two OracleTimeStampTZ values is greater than the second |
| GreaterThanOrEqual | Determines if the first of two OracleTimeStampTZ values is greater than or equal to the second |
| LessThan | Determines if the first of two OracleTimeStampTZ values is less than the second |
| LessThanOrEqual | Determines if the first of two OracleTimeStampTZ values is less than or equal to the second |
| NotEquals | Determines if two OracleTimeStampTZ values are not equal |
| Parse | Gets an OracleTimeStampTZ structure and sets its value for date and time using the supplied string |
| SetPrecision | Returns a new instance of an OracleTimeStampTZ with the specified fractional second precision |
OracleTimeStampTZ Static Operators
The OracleTimeStampTZ static operators are listed in Table 11-116.
Table 11-116 OracleTimeStampTZ Static Operators
| Operator | Description |
|---|---|
| operator + | Adds the supplied instance value to the supplied OracleTimeStampTZ and returns a new OracleTimeStampTZ structure (Overloaded) |
| operator == | Determines if two OracleTimeStampTZ values are equal |
| operator > | Determines if the first of two OracleTimeStampTZ values is greater than the second |
| operator >= | Determines if the first of two OracleTimeStampTZ values is greater than or equal to the second |
| operator != | Determines if two OracleTimeStampTZ values are not equal |
| operator < | Determines if the first of two OracleTimeStampTZ values is less than the second |
| operator <= | Determines if the first of two OracleTimeStampTZ values is less than or equal to the second |
| operator - | Subtracts the supplied instance value from the supplied OracleTimeStampTZ and returns a new OracleTimeStampTZ structure (Overloaded) |
OracleTimeStampTZ Static Type Conversions
The OracleTimeStampTZ static type conversions are listed in Table 11-117.
Table 11-117 OracleTimeStampTZ Static Type Conversions
| Operator | Description |
|---|---|
| explicit operator OracleTimeStampTZ | Converts an instance value to an OracleTimeStampTZ structure (Overloaded) |
| implicit operator OracleTimeStampTZ | Converts an instance value to an OracleTimeStampTZ structure (Overloaded) |
| explicit operator DateTime | Converts an OracleTimeStampTZ value to a DateTime structure in the current time zone |
OracleTimeStampTZ Properties
The OracleTimeStampTZ properties are listed in Table 11-118.
Table 11-118 OracleTimeStampTZ Properties
| Properties | Description |
|---|---|
| BinData | Returns an array of bytes that represents an Oracle TIMESTAMP WITH TIME ZONE in Oracle internal format |
| Day | Specifies the day component of an OracleTimeStampTZ in the current time zone |
| IsNull | Indicates whether or not the current instance has a null value |
| Hour | Specifies the hour component of an OracleTimeStampTZ in the current time zone |
| Millisecond | Specifies the millisecond component of an OracleTimeStampTZ in the current time zone |
| Minute | Specifies the minute component of an OracleTimeStampTZ in the current time zone |
| Month | Specifies the month component of an OracleTimeStampTZ in the current time zone |
| Nanosecond | Specifies the nanosecond component of an OracleTimeStampTZ in the current time zone |
| Second | Specifies the second component of an OracleTimeStampTZ in the current time zone |
| TimeZone | Returns the time zone of the OracleTimeStampTZ instance |
| Value | Returns the date and time that is stored in the OracleTimeStampTZ structure in the current time zone |
| Year | Specifies the year component of an OracleTimeStampTZ |
OracleTimeStampTZ Methods
The OracleTimeStampTZ methods are listed in Table 11-119.
Table 11-119 OracleTimeStampTZ Methods
| Methods | Description |
|---|---|
| AddDays | Adds the supplied number of days to the current instance |
| AddHours | Adds the supplied number of hours to the current instance |
| AddMilliseconds | Adds the supplied number of milliseconds to the current instance |
| AddMinutes | Adds the supplied number of minutes to the current instance |
| AddMonths | Adds the supplied number of months to the current instance |
| AddNanoseconds | Adds the supplied number of nanoseconds to the current instance |
| AddSeconds | Adds the supplied number of seconds to the current instance |
| AddYears | Adds the supplied number of years to the current instance |
| CompareTo | Compares the current OracleTimeStampTZ instance to an object, and returns an integer that represents their relative values |
| Equals | Determines whether or not an object has the same date and time as the current OracleTimeStampTZ instance |
| GetDaysBetween | Subtracts an OracleTimeStampTZ from the current instance and returns an OracleIntervalDS that represents the time interval |
| GetHashCode | Returns a hash code for the OracleTimeStampTZ instance |
| GetTimeZoneOffset | Gets the time zone information in hours and minutes of the current OracleTimeStampTZ |
| GetYearsBetween | Subtracts an OracleTimeStampTZ from the current instance and returns an OracleIntervalYM that represents the time interval |
| GetType | Inherited from Object |
| ToLocalTime | Converts the current OracleTimeStampTZ instance to local time |
| ToOracleDate | Converts the current OracleTimeStampTZ structure to an OracleDate structure |
| ToOracleTimeStampLTZ | Converts the current OracleTimeStampTZ structure to an OracleTimeStampLTZ structure |
| ToOracleTimeStamp | Converts the current OracleTimeStampTZ structure to an OracleTimeStamp structure |
| ToString | Converts the current OracleTimeStampTZ structure to a string |
| ToUniversalTime | Converts the current datetime to Coordinated Universal Time (UTC) |
The OracleTimeStampTZ constructors create new instances of the OracleTimeStampTZ structure.
Overload List:
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.
Declaration
// C#
public OracleTimeStampTZ (DateTime dt);
Parameters
dt
The supplied DateTime value.
Remarks
The time zone is set to the OracleGlobalization.TimeZone of the thread.
Exceptions
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.
Declaration
// C# public OracleTimeStampTZ (DateTime value1, string timeZone);
Parameters
value1
The supplied DateTime value.
timeZone
The time zone data provided.
Exceptions
ArgumentException - The argument values of the parameters cannot be used to construct a valid OracleTimeStampTZ.
Remarks
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.
Declaration
// C#
public OracleTimeStampTZ (string tsStr);
Parameters
tsStr
A string that represents an Oracle TIMESTAMP WITH TIME ZONE.
Exceptions
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.
Remarks
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.
Example
// 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());
}
}
This constructor creates a new instance of the OracleTimeStampTZ structure and sets its value for date and time using year, month, and day.
Declaration
// C# public OracleTimeStampTZ(int year, int month, int day);
Parameters
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).
Exceptions
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).
Remarks
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.
Declaration
// C# public OracleTimeStampTZ(int year, int month, int day, string timeZone);
Parameters
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.
Exceptions
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).
Remarks
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.
Declaration
// C# public OracleTimeStampTZ(int year, int month, int day, int hour, int minute, int second);
Parameters
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).
Exceptions
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).
Remarks
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.
Declaration
// C# public OracleTimeStampTZ (int year, int month, int day, int hour, int minute, int second, string timeZone);
Parameters
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.
Exceptions
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).
Remarks
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.
Declaration
// C# public OracleTimeStampTZ(int year, int month, int day, int hour, int minute, int second, double millisecond);
Parameters
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).
Exceptions
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).
Remarks
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.
Declaration
// C# public OracleTimeStampTZ(int year, int month, int day, int hour, int minute, int second, double millisecond, string timeZone);
Parameters
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.
Exceptions
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).
Remarks
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.
Declaration
// C# public OracleTimeStampTZ(int year, int month, int day, int hour, int minute, int second, int nanosecond);
Parameters
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).
Exceptions
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).
Remarks
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.
Declaration
// C# public OracleTimeStampTZ(int year, int month, int day, int hour, int minute, int second, int nanosecond, string timeZone);
Parameters
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.
Exceptions
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).
Remarks
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.
Declaration
// C#
public OracleTimeStampLTZ (byte[] bytes);
Parameters
bytes
The provided byte array that represents an Oracle TIMESTAMP WITH TIME ZONE in Oracle internal format.
Exceptions
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 11-120.
Table 11-120 OracleTimeStampTZ Static Fields
| Field | Description |
|---|---|
| MaxValue | Represents the maximum valid date for an OracleTimeStampTZ structure in UTC, which is December 31, 999923:59:59.999999999 |
| MinValue | Represents the minimum valid date for an OracleTimeStampTZ structure in UTC, which is January 1, -4712 0:0:0 |
| Null | Represents a null value that can be assigned to an instance of the OracleTimeStampTZ structure |
This static field represents the maximum valid datetime time for an OracleTimeStampTZ structure in UTC, which is December 31, 999923:59:59.999999999.
Declaration
// 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.
Declaration
// C# public static readonly OracleTimeStampTZ MinValue;
This static field represents a null value that can be assigned to an instance of the OracleTimeStampTZ structure.
Declaration
// C# public static readonly OracleTimeStampTZ Null;
The OracleTimeStampTZ static methods are listed in Table 11-121.
Table 11-121 OracleTimeStampTZ Static Methods
| Methods | Description |
|---|---|
| Equals | Determines if two OracleTimeStampTZ values are equal (Overloaded) |
| GetSysDate | Gets an OracleTimeStampTZ structure that represents the current date and time |
| GreaterThan | Determines if the first of two OracleTimeStampTZ values is greater than the second |
| GreaterThanOrEqual | Determines if the first of two OracleTimeStampTZ values is greater than or equal to the second |
| LessThan | Determines if the first of two OracleTimeStampTZ values is less than the second |
| LessThanOrEqual | Determines if the first of two OracleTimeStampTZ values is less than or equal to the second |
| NotEquals | Determines if two OracleTimeStampTZ values are not equal |
| Parse | Gets an OracleTimeStampTZ structure and sets its value for date and time using the supplied string |
| SetPrecision | Returns a new instance of an OracleTimeStampTZ with the specified fractional second precision |
This static method determines if two OracleTimeStampTZ values are equal.
Declaration
// C# public static bool Equals(OracleTimeStampTZ value1, OracleTimeStampTZ value2);
Parameters
value1
The first OracleTimeStampTZ.
value2
The second OracleTimeStampTZ.
Return Value
Returns true if two OracleTimeStampTZ values are equal. Returns false otherwise.
Remarks
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 OracleTimeStampTZs that contain a null value are equal.
This static method gets an OracleTimeStampTZ structure that represents the current date and time.
Declaration
// C# public static OracleTimeStampTZ GetSysDate();
Return Value
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.
Declaration
// C# public static bool GreaterThan(OracleTimeStampTZ value1, OracleTimeStampTZ value2);
Parameters
value1
The first OracleTimeStampTZ.
value2
The second OracleTimeStampTZ.
Return Value
Returns true if the first of two OracleTimeStampTZ values is greater than the second; otherwise, returns false.
Remarks
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 OracleTimeStampTZs 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.
Declaration
// C# public static bool GreaterThanOrEqual(OracleTimeStampTZ value1, OracleTimeStampTZ value2);
Parameters
value1
The first OracleTimeStampTZ.
value2
The second OracleTimeStampTZ.
Return Value
Returns true if the first of two OracleTimeStampTZ values is greater than or equal to the second; otherwise, returns false.
Remarks
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 OracleTimeStampTZs that contain a null value are equal.
This static method determines if the first of two OracleTimeStampTZ values is less than the second.
Declaration
// C# public static bool LessThan(OracleTimeStampTZ value1, OracleTimeStampTZ value2);
Parameters
value1
The first OracleTimeStampTZ.
value2
The second OracleTimeStampTZ.
Return Value
Returns true if the first of two OracleTimeStampTZ values is less than the second. Returns false otherwise.
Remarks
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 OracleTimeStampTZs 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.
Declaration
// C# public static bool LessThanOrEqual(OracleTimeStampTZ value1, OracleTimeStampTZ value2);
Parameters
value1
The first OracleTimeStampTZ.
value2
The second OracleTimeStampTZ.
Return Value
Returns true if the first of two OracleTimeStampTZ values is less than or equal to the second. Returns false otherwise.
Remarks
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 OracleTimeStampTZs that contain a null value are equal.
This static method determines if two OracleTimeStampTZ values are not equal.
Declaration
// C# public static bool NotEquals(OracleTimeStampTZ value1, OracleTimeStampTZ value2);
Parameters
value1
The first OracleTimeStampTZ.
value2
The second OracleTimeStampTZ.
Return Value
Returns true if two OracleTimeStampTZ values are not equal. Returns false otherwise.
Remarks
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 OracleTimeStampTZs 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.
Declaration
// C#
public static OracleTimeStampTZ Parse(string tsStr);
Parameters
tsStr
A string that represents an Oracle TIMESTAMP WITH TIME ZONE.
Return Value
An OracleTimeStampTZ structure.
Exceptions
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.
Remarks
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.
Example
// 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());
}
}
This static method returns a new instance of an OracleTimeStampTZ with the specified fractional second precision.
Declaration
// C# public static OracleTimeStampTZ SetPrecision(OracleTimeStampTZ value1, int fracSecPrecision);
Parameters
value1
The provided OracleTimeStampTZ object.
fracSecPrecision
The fractional second precision provided. Range of fractional second precision is (0 to 9).
Return Value
An OracleTimeStampTZ structure with the specified fractional second precision
Exceptions
ArgumentOutOfRangeException - fracSecPrecision is out of the specified range.
Remarks
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().
Example
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 11-122.
Table 11-122 OracleTimeStampTZ Static Operators
| Operator | Description |
|---|---|
| operator + | Adds the supplied instance value to the supplied OracleTimeStampTZ and returns a new OracleTimeStampTZ structure (Overloaded) |
| operator == | Determines if two OracleTimeStampTZ values are equal |
| operator > | Determines if the first of two OracleTimeStampTZ values is greater than the second |
| operator >= | Determines if the first of two OracleTimeStampTZ values is greater than or equal to the second |
| operator != | Determines if two OracleTimeStampTZ values are not equal |
| operator < | Determines if the first of two OracleTimeStampTZ values is less than the second |
| operator <= | Determines if the first of two OracleTimeStampTZ values is less than or equal to the second |
| operator - | Subtracts the supplied instance value from the supplied OracleTimeStampTZ and returns a new OracleTimeStampTZ structure (Overloaded) |
operator+ adds the supplied structure to the supplied OracleTimeStampTZ and returns a new OracleTimeStampTZ structure.
Overload List:
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.
Declaration
// C# public static operator +(OracleTimeStampTZ value1, OracleIntervalDS value2);
Parameters
value1
An OracleTimeStampTZ.
value2
An OracleIntervalDS.
Return Value
An OracleTimeStampTZ.
Remarks
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.
Declaration
// C# public static operator +(OracleTimeStampTZ value1, OracleIntervalYM value2);
Parameters
value1
An OracleTimeStampTZ.
value2
An OracleIntervalYM.
Return Value
An OracleTimeStampTZ.
Remarks
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.
Declaration
// C# public static operator +(OracleTimeStampTZ value1, TimeSpan value2);
Parameters
value1
An OracleTimeStampTZ.
value2
A TimeSpan.
Return Value
An OracleTimeStampTZ.
Remarks
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.
Declaration
// C# public static bool operator == (OracleTimeStampTZ value1, OracleTimeStampTZ value2);
Parameters
value1
The first OracleTimeStampTZ.
value2
The second OracleTimeStampTZ.
Return Value
Returns true if they are equal; otherwise returns false.
Remarks
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 OracleTimeStampTZs that contain a null value are equal.
This static operator determines if the first of two OracleTimeStampTZ values is greater than the second.
Declaration
// C# public static bool operator > (OracleTimeStampTZ value1, OracleTimeStampTZ value2);
Parameters
value1
The first OracleTimeStampTZ.
value2
The second OracleTimeStampTZ.
Return Value
Returns true if the first OracleTimeStampTZ value is greater than the second; otherwise, returns false.
Remarks
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 OracleTimeStampTZs 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.
Declaration
// C# public static bool operator >= (OracleTimeStampTZ value1, OracleTimeStampTZ value2);
Parameters
value1
The first OracleTimeStampTZ.
value2
The second OracleTimeStampTZ.
Return Value
Returns true if the first OracleTimeStampTZ is greater than or equal to the second; otherwise, returns false.
Remarks
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 OracleTimeStampTZs that contain a null value are equal.
This static operator determines if two OracleTimeStampTZ values are not equal.
Declaration
// C# public static bool operator != (OracleTimeStampTZ value1, OracleTimeStampTZ value2);
Parameters
value1
The first OracleTimeStampTZ.
value2
The second OracleTimeStampTZ.
Return Value
Returns true if two OracleTimeStampTZ values are not equal; otherwise, returns false.
Remarks
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 OracleTimeStampTZs that contain a null value are equal.
This static operator determines if the first of two OracleTimeStampTZ values is less than the second.
Declaration
// C# public static bool operator < (OracleTimeStampTZ value1, OracleTimeStampTZ value2);
Parameters
value1
The first OracleTimeStampTZ.
value2
The second OracleTimeStampTZ.
Return Value
Returns true if the first OracleTimeStampTZ is less than the second; otherwise returns false.
Remarks
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 OracleTimeStampTZs 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.
Declaration
// C# public static bool operator <= (OracleTimeStampTZ value1, OracleTimeStampTZ value2);
Parameters
value1
The first OracleTimeStampTZ.
value2
The second OracleTimeStampTZ.
Return Value
Returns true if the first OracleTimeStampTZ is less than or equal to the second; otherwise, returns false.
Remarks
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 OracleTimeStampTZs that contain a null value are equal.
operator- subtracts the supplied value, from the supplied OracleTimeStampTZ value, and returns a new OracleTimeStampTZ structure.
Overload List:
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.
Declaration
// C# public static operator - (OracleTimeStampTZ value1, OracleIntervalDS value2);
Parameters
value1
An OracleTimeStampTZ.
value2
An OracleIntervalDS.
Return Value
An OracleTimeStampTZ structure.
Remarks
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.
Declaration
// C# public static operator - (OracleTimeStampTZ value1, OracleIntervalYM value2);
Parameters
value1
An OracleTimeStampTZ.
value2
An OracleIntervalYM.
Return Value
An OracleTimeStampTZ structure.
Remarks
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.
Declaration
// C# public static operator - (OracleTimeStampTZ value1, TimeSpan value2);
Parameters
value1
An OracleTimeStampTZ.
value2
A TimeSpan.
Return Value
An OracleTimeStampTZ structure.
Remarks
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 11-123.
Table 11-123 OracleTimeStampTZ Static Type Conversions
| Operator | Description |
|---|---|
| explicit operator OracleTimeStampTZ | Converts an instance value to an OracleTimeStampTZ structure (Overloaded) |
| implicit operator OracleTimeStampTZ | Converts an instance value to an OracleTimeStampTZ structure (Overloaded) |
| explicit operator DateTime | Converts an OracleTimeStampTZ value to a DateTime structure in the current time zone |
explicit operator OracleTimeStampTZ converts an instance value to an OracleTimeStampTZ structure.
Overload List:
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.
This static type conversion operator converts an OracleTimeStamp value to an OracleTimeStampTZ structure.
Declaration
// C# public static explicit operator OracleTimeStampTZ(OracleTimeStamp value1);
Parameters
value1
An OracleTimeStamp.
Return Value
The returned OracleTimeStampTZ contains the date and time from the OracleTimeStamp and the time zone from the OracleGlobalization.TimeZone of the thread.
Remarks
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.
This static type conversion operator converts an OracleTimeStampLTZ value to an OracleTimeStampTZ structure.
Declaration
// C#
public static explicit operator OracleTimeStampTZ(OracleTimeStampLTZ value1);
Parameters
value1
An OracleTimeStampLTZ.
Return Value
The returned OracleTimeStampTZ contains the date and time from the OracleTimeStampLTZ and the time zone from the OracleGlobalization.TimeZone of the thread.
Remarks
If the OracleTimeStampLTZ structure has a null value, the returned OracleTimeStampTZ structure also has a null value.
This static type conversion operator converts the supplied string value to an OracleTimeStampTZ structure.
Declaration
// C#
public static explicit operator OracleTimeStampTZ(string tsStr);
Parameters
tsStr
A string representation of an Oracle TIMESTAMP WITH TIME ZONE.
Return Value
An OracleTimeStampTZ value.
Exceptions
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.
Remarks
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.
Example
// 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());
}
}
implicit operator OracleTimeStampTZ converts a DateTime structure to an OracleTimeStampTZ structure.
Overload List:
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.
This static type conversion operator converts an OracleDate value to an OracleTimeStampTZ structure.
Declaration
// C#
public static implicit operator OracleTimeStampTZ(OracleDate value1);
Parameters
value1
An OracleDate.
Return Value
The returned OracleTimeStampTZ contains the date and time from the OracleDate and the time zone from the OracleGlobalization.TimeZone of the thread.
Remarks
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.
This static type conversion operator converts a DateTime structure to an OracleTimeStampTZ structure.
Declaration
// C#
public static implicit operator OracleTimeStampTZ (DateTime value1);
Parameters
value1
A DateTime structure.
Return Value
The returned OracleTimeStampTZ contains the date and time from the DateTime and the time zone from the OracleGlobalization.TimeZone of the thread.
Remarks
The OracleGlobalization.TimeZone of the thread is used to convert from a DateTime to an Oracle TimeStampTZ structure.
This static type conversion operator converts an OracleTimeStampTZ value to a DateTime structure in the current time zone.
Declaration
// C#
public static explicit operator DateTime(OracleTimeStampTZ value1);
Parameters
value1
An OracleTimeStampTZ.
Return Value
A DateTime containing the date and time in the current instance, but with the time zone information in the current instance truncated.
Exceptions
OracleNullValueException - The OracleTimeStampTZ structure has a null value.
Remarks
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 11-124.
Table 11-124 OracleTimeStampTZ Properties
| Properties | Description |
|---|---|
| BinData | Returns an array of bytes that represents an Oracle TIMESTAMP WITH TIME ZONE in Oracle internal format |
| Day | Specifies the day component of an OracleTimeStampTZ in the current time zone |
| IsNull | Indicates whether or not the current instance has a null value |
| Hour | Specifies the hour component of an OracleTimeStampTZ in the current time zone |
| Millisecond | Specifies the millisecond component of an OracleTimeStampTZ in the current time zone |
| Minute | Specifies the minute component of an OracleTimeStampTZ in the current time zone |
| Month | Specifies the month component of an OracleTimeStampTZ in the current time zone |
| Nanosecond | Specifies the nanosecond component of an OracleTimeStampTZ in the current time zone |
| Second | Specifies the second component of an OracleTimeStampTZ in the current time zone |
| TimeZone | Returns the time zone of the OracleTimeStampTZ instance |
| Value | Returns the date and time that is stored in the OracleTimeStampTZ structure in the current time zone |
| Year | Specifies the year component of an OracleTimeStampTZ |
This property returns an array of bytes that represents an Oracle TIMESTAMP WITH TIME ZONE in Oracle internal format.
Declaration
// C#
public byte[] BinData {get;}
Property Value
The provided byte array that represents an Oracle TIMESTAMP WITH TIME ZONE in Oracle internal format.
Exceptions
OracleNullValueException - The current instance has a null value.
This property specifies the day component of an OracleTimeStampTZ in the current time zone.
Declaration
// C#
public int Day{get;}
Property Value
A number that represents the day. Range of Day is (1 to 31).
Exceptions
OracleNullValueException - The current instance has a null value.
This property indicates whether or not the current instance has a null value.
Declaration
// C#
public bool IsNull{get;}
Property Value
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.
Declaration
// C#
public int Hour{get;}
Property Value
A number that represents the hour. Range of Hour is (0 to 23).
Exceptions
OracleNullValueException - The current instance has a null value.
This property gets the millisecond component of an OracleTimeStampTZ in the current time zone.
Declaration
// C#
public double Millisecond{get;}
Property Value
A number that represents a millisecond. Range of Millisecond is (0 to 999.999999)
Exceptions
OracleNullValueException - The current instance has a null value.
This property gets the minute component of an OracleTimeStampTZ in the current time zone.
Declaration
// C#
public int Minute{get;}
Property Value
A number that represent a minute. Range of Minute is (0 to 59).
Exceptions
OracleNullValueException - The current instance has a null value.
This property gets the month component of an OracleTimeStampTZ in the current time zone
Declaration
// C#
public int Month{get;}
Property Value
A number that represents a month. Range of Month is (1 to 12).
Exceptions
OracleNullValueException - The current instance has a null value.
This property gets the nanosecond component of an OracleTimeStampTZ in the current time zone.
Declaration
// C#
public int Nanosecond{get;}
Property Value
A number that represents a nanosecond. Range of Nanosecond is (0 to 999999999).
Exceptions
OracleNullValueException - The current instance has a null value.
This property gets the second component of an OracleTimeStampTZ in the current time zone.
Declaration
// C#
public int Second{get;}
Property Value
A number that represents a second. Range of Second is (0 to 59).
Exceptions
OracleNullValueException - The current instance has a null value.
This property returns the time zone of the OracleTimeStampTZ instance.
Declaration
// C#
public string TimeZone{get;}
Property Value
A string that represents the time zone.
Remarks
If no time zone is specified in the constructor, this property is set to the thread's OracleGlobalization.TimeZone by default
This property returns the date and time that is stored in the OracleTimeStampTZ structure in the current time zone.
Declaration
// C#
public DateTime Value{get;}
Property Value
A DateTime in the current time zone.
Exceptions
OracleNullValueException - The current instance has a null value.
This property sets the year component of an OracleTimeStampTZ in the current time zone.
Declaration
// C#
public int Year{get;}
Property Value
A number that represents a year. The range of Year is (-4712 to 9999).
Exceptions
OracleNullValueException - The current instance has a null value.
The OracleTimeStampTZ methods are listed in Table 11-125.
Table 11-125 OracleTimeStampTZ Methods
| Methods | Description |
|---|---|
| AddDays | Adds the supplied number of days to the current instance |
| AddHours | Adds the supplied number of hours to the current instance |
| AddMilliseconds | Adds the supplied number of milliseconds to the current instance |
| AddMinutes | Adds the supplied number of minutes to the current instance |
| AddMonths | Adds the supplied number of months to the current instance |
| AddNanoseconds | Adds the supplied number of nanoseconds to the current instance |
| AddSeconds | Adds the supplied number of seconds to the current instance |
| AddYears | Adds the supplied number of years to the current instance |
| CompareTo | Compares the current OracleTimeStampTZ instance to an object, and returns an integer that represents their relative values |
| Equals | Determines whether or not an object has the same date and time as the current OracleTimeStampTZ instance (Overloaded) |
| GetDaysBetween | Subtracts an OracleTimeStampTZ from the current instance and returns an OracleIntervalDS that represents the time interval |
| GetHashCode | Returns a hash code for the OracleTimeStampTZ instance |
| GetTimeZoneOffset | Gets the time zone information in hours and minutes of the current OracleTimeStampTZ |
| GetYearsBetween | Subtracts an OracleTimeStampTZ from the current instance and returns an OracleIntervalYM that represents the time interval |
| GetType | Inherited from Object |
| ToLocalTime | Converts the current OracleTimeStampTZ instance to local time |
| ToOracleDate | Converts the current OracleTimeStampTZ structure to an OracleDate structure |
| ToOracleTimeStampLTZ | Converts the current OracleTimeStampTZ structure to an OracleTimeStampLTZ structure |
| ToOracleTimeStamp | Converts the current OracleTimeStampTZ structure to an OracleTimeStamp structure |
| ToString | Converts the current OracleTimeStampTZ structure to a string |
| ToUniversalTime | Converts the current datetime to Coordinated Universal Time (UTC) |
This method adds the supplied number of days to the current instance.
Declaration
// C#
public OracleTimeStampTZ AddDays(double days);
Parameters
days
The supplied number of days. Range is (-1,000,000,000 < days < 1,000,000,000)
Return Value
An OracleTimeStampTZ.
Exceptions
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.
Declaration
// C#
public OracleTimeStampTZ AddHours(double hours);
Parameters
hours
The supplied number of hours. Range is (-24,000,000,000 < hours < 24,000,000,000).
Return Value
An OracleTimeStampTZ.
Exceptions
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.
Declaration
// C#
public OracleTimeStampTZ AddMilliseconds(double milliseconds);
Parameters
milliseconds
The supplied number of milliseconds. Range is (-8.64 * 1016< milliseconds < 8.64 * 1016).
Return Value
An OracleTimeStampTZ.
Exceptions
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.
Declaration
// C#
public OracleTimeStampTZ AddMinutes(double minutes);
Parameters
minutes
The supplied number of minutes. Range is (-1,440,000,000,000 < minutes < 1,440,000,000,000).
Return Value
An OracleTimeStampTZ.
Exceptions
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.
Declaration
// C#
public OracleTimeStampTZ AddMonths(long months);
Parameters
months
The supplied number of months. Range is (-12,000,000,000 < months < 12,000,000,000).
Return Value
An OracleTimeStampTZ.
Exceptions
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.
Declaration
// C#
public OracleTimeStampTZ AddNanoseconds(long nanoseconds);
Parameters
nanoseconds
The supplied number of nanoseconds.
Return Value
An OracleTimeStampTZ.
Exceptions
OracleNullValueException - The current instance has a null value.
This method adds the supplied number of seconds to the current instance.
Declaration
// C#
public OracleTimeStampTZ AddSeconds(double seconds);
Parameters
seconds
The supplied number of seconds. Range is (-8.64 * 1013< seconds < 8.64 * 1013).
Return Value
An OracleTimeStampTZ.
Exceptions
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
Declaration
// C#
public OracleTimeStampTZ AddYears(int years);
Parameters
years
The supplied number of years. Range is (-999,999,999 <= years < = 999,999,999).
Return Value
An OracleTimeStampTZ.
Exceptions
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.
Declaration
// C#
public int CompareTo(object obj);
Parameters
obj
The object being compared to the current OracleTimeStampTZ instance.
Return Value
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.
Implements
IComparable
Exceptions
ArgumentException - The obj is not of type OracleTimeStampTZ.
Remarks
The following rules apply to the behavior of this method.
The comparison must be between OracleTimeStampTZs. 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 OracleTimeStampTZs 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.
Declaration
// C#
public override bool Equals(object obj);
Parameters
obj
The object being compared to the current OracleTimeStampTZ instance.
Return Value
Returns true if the obj is of type OracleTimeStampTZ and represents the same date and time; otherwise, returns false.
Remarks
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 OracleTimeStampTZs 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.
Declaration
// C#
public OracleIntervalDS GetDaysBetween(OracleTimeStampTZ value1);
Parameters
value1
The OracleTimeStampTZ value being subtracted.
Return Value
An OracleIntervalDS that represents the interval between two OracleTimeStampTZ values.
Remarks
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.
Declaration
// C# public override int GetHashCode();
Return Value
A number that represents the hash code.
This method gets the time zone portion in hours and minutes of the current OracleTimeStampTZ.
Declaration
// C# public TimeSpan GetTimeZoneOffset();
Return Value
A TimeSpan.
Exceptions
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.
Declaration
// C#
public OracleIntervalYM GetYearsBetween(OracleTimeStampTZ val);
Parameters
val
The OracleTimeStampTZ value being subtracted.
Return Value
An OracleIntervalYM that represents the interval between two OracleTimeStampTZ values.
Remarks
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.
Declaration
// C# public OracleTimeStampLTZ ToLocalTime();
Return Value
An OracleTimeStampLTZ that contains the date and time, which is normalized to the client local time zone, in the current instance.
Remarks
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.
Declaration
// C# public OracleDate ToOracleDate();
Return Value
The returned OracleDate contains the date and time in the current instance, but the time zone information in the current instance is truncated
Remarks
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.
Declaration
// C# public OracleTimeStampLTZ ToOracleTimeStampLTZ();
Return Value
The returned OracleTimeStampLTZ structure contains the date and time, which is normalized to the client local time zone, in the current instance.
Remarks
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.
Declaration
// C# public OracleTimeStamp ToOracleTimeStamp();
Return Value
The returned OracleTimeStamp contains the date and time in the current instance, but the time zone information is truncated.
Remarks
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.
Declaration
// C# public override string ToString();
Return Value
A string that represents the same date and time as the current OracleTimeStampTZ structure.
Remarks
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.
Example
// 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);
}
}
This method converts the current datetime to Coordinated Universal Time (UTC).
Declaration
// C# public OracleTimeStampTZ ToUniversalTime();
Return Value
An OracleTimeStampTZ structure.
Remarks
If the current instance has a null value, the value of the returned OracleTimeStampTZ structure has a null value.