Skip Headers
Oracle® Data Provider for .NET Developer's Guide
11g Release 2 (11.2.0.3)

Part Number E23174-02
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
PDF · Mobi · ePub

OracleTimeStampTZ Structure

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.

Class Inheritance

System.Object

  System.ValueType

    Oracle.DataAccess.Types.OracleTimeStampTZ

Declaration

// ADO.NET 2.0: C#
public struct OracleTimeStampTZ : IComparable, INullable, IXmlSerializable

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

ODP.NET Version: ODP.NET for .NET Framework 2.0 or ODP.NET for .NET Framework 4


OracleTimeStampTZ Members

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

OracleTimeStampTZ Constructors

Instantiates a new instance of OracleTimeStampTZ structure (Overloaded)


OracleTimeStampTZ Static Fields

The OracleTimeStampTZ static fields are listed in Table 14-114.

Table 14-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 14-115.

Table 14-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 14-116.

Table 14-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 14-117.

Table 14-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


OracleTimeStampTZ Properties

The OracleTimeStampTZ properties are listed in Table 14-118.

Table 14-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 14-119.

Table 14-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 System.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)



OracleTimeStampTZ Constructors

The OracleTimeStampTZ constructors create new instances of the OracleTimeStampTZ structure.

Overload List:

OracleTimeStampTZ(DateTime)

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

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.

OracleTimeStampTZ(DateTime, string)

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

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 by OracleTimeStampTZ.

OracleTimeStampTZ(string)

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

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());    
  }
}

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.

Declaration

// C#
public OracleTimeStampTZ(int year, int month, int day);

Parameters

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.

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.

Declaration

// C#
public OracleTimeStampTZ(int year, int month, int day, 
  string timeZone);

Parameters

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 by OracleTimeStampTZ.

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.

Declaration

// C#
public OracleTimeStampTZ(int year, int month, int day, int hour,
  int minute,  int second);

Parameters

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.

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.

Declaration

// C#
public OracleTimeStampTZ (int year, int month, int day, int hour, 
  int minute, int second, string timeZone);

Parameters

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 by OracleTimeStampTZ.

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.

Declaration

// C#
public OracleTimeStampTZ(int year, int month, int day, int hour,
 int minute, int second, double millisecond);

Parameters

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.

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.

Declaration

// C#
public OracleTimeStampTZ(int year, int month, int day, int hour, 
  int minute,   int second, double millisecond, string timeZone);

Parameters

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 by OracleTimeStampTZ.

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.

Declaration

// C#
public OracleTimeStampTZ(int year, int month, int day, int hour, 
  int minute, int second, int nanosecond);

Parameters

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.

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.

Declaration

// C#
public OracleTimeStampTZ(int year, int month, int day, int hour, 
  int minute, int second, int nanosecond, string timeZone);

Parameters

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 by OracleTimeStampTZ.

OracleTimeStampTZ(byte [ ])

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

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.


OracleTimeStampTZ Static Fields

The OracleTimeStampTZ static fields are listed in Table 14-120.

Table 14-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


MaxValue

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;

MinValue

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;

Null

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;

OracleTimeStampTZ Static Methods

The OracleTimeStampTZ static methods are listed in Table 14-121.

Table 14-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


Equals

This static method determines if two OracleTimeStampTZ values are equal.

Declaration

// C#
public static bool Equals(OracleTimeStampTZ value1, 
  OracleTimeStampTZ value2);

Parameters

Return Value

Returns true if two OracleTimeStampTZ values are equal. Returns false otherwise.

Remarks

The following rules apply to the behavior of this method.

GetSysDate

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.

GreaterThan

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

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.

GreaterThanOrEqual

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

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.

LessThan

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

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.

LessThanOrEqual

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

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.

NotEquals

This static method determines if two OracleTimeStampTZ values are not equal.

Declaration

// C#
public static bool NotEquals(OracleTimeStampTZ value1, 
  OracleTimeStampTZ value2);

Parameters

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.

Parse

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

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());   
  }
}

SetPrecision

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

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.


OracleTimeStampTZ Static Operators

The OracleTimeStampTZ static operators are listed in Table 14-122.

Table 14-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 +

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.

Declaration

// C#
public static operator +(OracleTimeStampTZ value1, 
  OracleIntervalDS value2);

Parameters

Return Value

An OracleTimeStampTZ.

Remarks

If either parameter has a null value, the returned OracleTimeStampTZ has a null value.

operator +(OracleTimeStampTZ, OracleIntervalYM)

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

Return Value

An OracleTimeStampTZ.

Remarks

If either parameter has a null value, the returned OracleTimeStampTZ has a null value.

operator +(OracleTimeStampTZ, TimeSpan)

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

Return Value

An OracleTimeStampTZ.

Remarks

If the OracleTimeStampTZ instance has a null value, the returned OracleTimeStampTZ has a null value.

operator ==

This static operator determines if two OracleTimeStampTZ values are equal.

Declaration

// C#
public static bool operator == (OracleTimeStampTZ value1, 
     OracleTimeStampTZ value2);

Parameters

Return Value

Returns true if they are equal; otherwise returns false.

Remarks

The following rules apply to the behavior of this method.

operator >

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

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.

operator >=

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

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.

operator !=

This static operator determines if two OracleTimeStampTZ values are not equal.

Declaration

// C#
public static bool operator != (OracleTimeStampTZ value1, 
   OracleTimeStampTZ value2);

Parameters

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.

operator <

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

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.

operator <=

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

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.

operator -

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.

Declaration

// C#
public static operator - (OracleTimeStampTZ value1, 
  OracleIntervalDS value2);

Parameters

Return Value

An OracleTimeStampTZ structure.

Remarks

If either parameter has a null value, the returned OracleTimeStampTZ has a null value.

operator - (OracleTimeStampTZ, OracleIntervalYM)

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

Return Value

An OracleTimeStampTZ structure.

Remarks

If either parameter has a null value, the returned OracleTimeStampTZ has a null value.

operator - (OracleTimeStampTZ value1, TimeSpan value2)

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

Return Value

An OracleTimeStampTZ structure.

Remarks

If the OracleTimeStampTZ instance has a null value, the returned OracleTimeStampTZ structure has a null value.


OracleTimeStampTZ Static Type Conversions

The OracleTimeStampTZ static type conversions are listed in Table 14-123.

Table 14-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

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.

Declaration

// C#
public static explicit operator OracleTimeStampTZ(OracleTimeStamp value1);

Parameters

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.

explicit operator OracleTimeStampTZ(OracleTimeStampLTZ)

This static type conversion operator converts an OracleTimeStampLTZ value to an OracleTimeStampTZ structure.

Declaration

// C#
public static explicit operator OracleTimeStampTZ(OracleTimeStampLTZ value1);

Parameters

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.

explicit operator OracleTimeStampTZ(string)

This static type conversion operator converts the supplied string value to an OracleTimeStampTZ structure.

Declaration

// C#
public static explicit operator OracleTimeStampTZ(string tsStr);

Parameters

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

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.

Declaration

// C#
public static implicit operator OracleTimeStampTZ(OracleDate value1);

Parameters

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.

implicit operator OracleTimeStampTZ(DateTime)

This static type conversion operator converts a DateTime structure to an OracleTimeStampTZ structure.

Declaration

// C#
public static implicit operator OracleTimeStampTZ (DateTime value1);

Parameters

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.

explicit operator DateTime

This static type conversion operator converts an OracleTimeStampTZ value to a DateTime structure and truncates the time zone information.

Declaration

// C#
public static explicit operator DateTime(OracleTimeStampTZ value1);

Parameters

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


OracleTimeStampTZ Properties

The OracleTimeStampTZ properties are listed in Table 14-124.

Table 14-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


BinData

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.

Day

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.

IsNull

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.

Hour

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.

Millisecond

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.

Minute

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.

Month

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.

Nanosecond

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.

Second

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.

TimeZone

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

Value

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.

Year

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.


OracleTimeStampTZ Methods

The OracleTimeStampTZ methods are listed in Table 14-125.

Table 14-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 System.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)


AddDays

This method adds the supplied number of days to the current instance.

Declaration

// C#
public OracleTimeStampTZ AddDays(double days);

Parameters

Return Value

An OracleTimeStampTZ.

Exceptions

OracleNullValueException - The current instance has a null value.

ArgumentOutofRangeException - The argument value is out of the specified range.

AddHours

This method adds the supplied number of hours to the current instance.

Declaration

// C#
public OracleTimeStampTZ AddHours(double hours);

Parameters

Return Value

An OracleTimeStampTZ.

Exceptions

OracleNullValueException - The current instance has a null value.

ArgumentOutofRangeException - The argument value is out of the specified range.

AddMilliseconds

This method adds the supplied number of milliseconds to the current instance.

Declaration

// C#
public OracleTimeStampTZ AddMilliseconds(double milliseconds);

Parameters

Return Value

An OracleTimeStampTZ.

Exceptions

OracleNullValueException - The current instance has a null value.

ArgumentOutofRangeException - The argument value is out of the specified range.

AddMinutes

This method adds the supplied number of minutes to the current instance.

Declaration

// C#
public OracleTimeStampTZ AddMinutes(double minutes);

Parameters

Return Value

An OracleTimeStampTZ.

Exceptions

OracleNullValueException - The current instance has a null value.

ArgumentOutofRangeException - The argument value is out of the specified range.

AddMonths

This method adds the supplied number of months to the current instance.

Declaration

// C#
public OracleTimeStampTZ AddMonths(long months);

Parameters

Return Value

An OracleTimeStampTZ.

Exceptions

OracleNullValueException - The current instance has a null value.

ArgumentOutofRangeException - The argument value is out of the specified range.

AddNanoseconds

This method adds the supplied number of nanoseconds to the current instance.

Declaration

// C#
public OracleTimeStampTZ AddNanoseconds(long nanoseconds);

Parameters

Return Value

An OracleTimeStampTZ.

Exceptions

OracleNullValueException - The current instance has a null value.

AddSeconds

This method adds the supplied number of seconds to the current instance.

Declaration

// C#
public OracleTimeStampTZ AddSeconds(double seconds);

Parameters

Return Value

An OracleTimeStampTZ.

Exceptions

OracleNullValueException - The current instance has a null value.

ArgumentOutofRangeException - The argument value is out of the specified range.

AddYears

This method adds the supplied number of years to the current instance

Declaration

// C#
public OracleTimeStampTZ AddYears(int years);

Parameters

Return Value

An OracleTimeStampTZ.

Exceptions

OracleNullValueException - The current instance has a null value.

ArgumentOutofRangeException - The argument value is out of the specified range.

CompareTo

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

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.

Equals

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

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.

GetDaysBetween

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

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.

GetHashCode

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.

GetTimeZoneOffset

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.

GetYearsBetween

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

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.

ToLocalTime

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.

ToOracleDate

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.

ToOracleTimeStampLTZ

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.

ToOracleTimeStamp

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.

ToString

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);    
  }
}

ToUniversalTime

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.