OracleTimeStampLTZ Structure

The OracleTimeStampLTZ structure represents the Oracle TIMESTAMP WITH LOCAL TIME ZONE data type to be stored in or retrieved from a database. Each OracleTimeStampLTZ stores the following information: year, month, day, hour, minute, second, and nanosecond.

Class Inheritance

System.Object

  System.ValueType

    Oracle.DataAccess.Types.OracleTimeStampLTZ

Declaration

// C#
public struct OracleTimeStampLTZ : IComparable, INullable, IXmlSerializable

Requirements

Provider ODP.NET, Unmanaged Driver ODP.NET, Managed Driver
Assembly Oracle.DataAccess.dll Oracle.ManagedDataAccess.dll
Namespace Oracle.DataAccess.Types Oracle.ManagedDataAccess.Types
.NET Framework 3.5, 4.0, 4.5 4.0, 4.5

Thread Safety

All public static methods are thread-safe, although instance methods do not guarantee thread safety.

Example

// C#
 
using System;
using Oracle.DataAccess.Types;
using Oracle.DataAccess.Client;
 
class OracleTimeStampLTZSample
{
  static void Main()
  {
    // Illustrates usage of OracleTimeStampLTZ
    // Display Local Time Zone Name
    Console.WriteLine("Local Time Zone Name = " +
      OracleTimeStampLTZ.GetLocalTimeZoneName());
    OracleTimeStampLTZ tsLocal1 = OracleTimeStampLTZ.GetSysDate();
    OracleTimeStampLTZ tsLocal2 = DateTime.Now;
    
    // Calculate the difference between tsLocal1 and tsLocal2
    OracleIntervalDS idsDiff = tsLocal2.GetDaysBetween(tsLocal1);
    
    // Calculate the difference using AddNanoseconds()
    int nanoDiff = 0;
    while (tsLocal2 > tsLocal1)
    {
      nanoDiff += 10;
      tsLocal1 = tsLocal1.AddNanoseconds(10);
    }
    Console.WriteLine("idsDiff.Nanoseconds = " + idsDiff.Nanoseconds);
    Console.WriteLine("nanoDiff = " + nanoDiff);
  }
}

OracleTimeStampLTZ Members

OracleTimeStampLTZ members are listed in the following tables:

OracleTimeStampLTZ Constructors

OracleTimeStampLTZ constructors are listed in Table 14-113

Table 14-113 OracleTimeStampLTZConstructors

Constructor Description

OracleTimeStampLTZ Constructors

Instantiates a new instance of OracleTimeStampLTZ structure (Overloaded)


OracleTimeStampLTZ Static Fields

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

Table 14-114 OracleTimeStampLTZ Static Fields

Field Description

MaxValue

Represents the maximum valid date for an OracleTimeStampLTZ structure, which is December 31, 9999 23:59:59.999999999

MinValue

Represents the minimum valid date for an OracleTimeStampLTZ structure, which is January 1, -4712 0:0:0

Null

Represents a null value that can be assigned to an instance of the OracleTimeStampLTZ structure


OracleTimeStampLTZ Static Methods

The OracleTimeStampLTZ static methods are listed in Table 14-115.

Table 14-115 OracleTimeStampLTZ Static Methods

Methods Description

Equals

Determines if two OracleTimeStampLTZ values are equal (Overloaded)

GetLocalTimeZoneName

Gets the client's local time zone name

GetLocalTimeZoneOffset

Gets the client's local time zone offset relative to UTC

GetSysDate

Gets an OracleTimeStampLTZ structure that represents the current date and time

GreaterThan

Determines if the first of two OracleTimeStampLTZ values is greater than the second

GreaterThanOrEqual

Determines if the first of two OracleTimeStampLTZ values is greater than or equal to the second

LessThan

Determines if the first of two OracleTimeStampLTZ values is less than the second

LessThanOrEqual

Determines if the first of two OracleTimeStampLTZ values is less than or equal to the second

NotEquals

Determines if two OracleTimeStampLTZ values are not equal

Parse

Gets an OracleTimeStampLTZ structure and sets its value for date and time using the supplied string

SetPrecision

Returns a new instance of an OracleTimeStampLTZ with the specified fractional second precision


OracleTimeStampLTZ Static Operators

The OracleTimeStampLTZ static operators are listed in Table 14-116.

Table 14-116 OracleTimeStampLTZ Static Operators

Operator Description

operator +

Adds the supplied instance value to the supplied OracleTimeStampLTZ and returns a new OracleTimeStampLTZ structure (Overloaded)

operator ==

Determines if two OracleTimeStampLTZ values are equal

operator >

Determines if the first of two OracleTimeStampLTZ values is greater than the second

operator >=

Determines if the first of two OracleTimeStampLTZ values is greater than or equal to the second

operator !=

Determines if two OracleTimeStampLTZ values are not equal

operator <

Determines if the first of two OracleTimeStampLTZ values is less than the second

operator <=

Determines if the first of two OracleTimeStampLTZ values is less than or equal to the second

operator -

Subtracts the supplied instance value from the supplied OracleTimeStampLTZ and returns a new OracleTimeStampLTZ structure (Overloaded)


OracleTimeStampLTZ Static Type Conversions

The OracleTimeStampLTZ static type conversions are listed in Table 14-117.

Table 14-117 OracleTimeStampLTZ Static Type Conversions

Operator Description

explicit operator OracleTimeStampLTZ

Converts an instance value to an OracleTimeStampLTZ structure (Overloaded)

implicit operator OracleTimeStampLTZ

Converts an instance value to an OracleTimeStampLTZ structure (Overloaded)

explicit operator DateTime

Converts an OracleTimeStampLTZ value to a DateTime structure


OracleTimeStampLTZ Properties

The OracleTimeStampLTZ properties are listed in Table 14-118.

Table 14-118 OracleTimeStampLTZ Properties

Properties Description

BinData

Returns an array of bytes that represents an Oracle TIMESTAMP WITH LOCAL TIME ZONE in Oracle internal format

Day

Specifies the day component of an OracleTimeStampLTZ

IsNull

Indicates whether or not the OracleTimeStampLTZ instance has a null value

Hour

Specifies the hour component of an OracleTimeStampLTZ

Millisecond

Specifies the millisecond component of an OracleTimeStampLTZ

Minute

Specifies the minute component of an OracleTimeStampLTZ

Month

Specifies the month component of an OracleTimeStampLTZ

Nanosecond

Specifies the nanosecond component of an OracleTimeStampLTZ

Second

Specifies the second component of an OracleTimeStampLTZ

Value

Specifies the date and time that is stored in the OracleTimeStampLTZ structure

Year

Specifies the year component of an OracleTimeStampLTZ


OracleTimeStampLTZ Methods

The OracleTimeStampLTZ methods are listed in Table 14-119.

Table 14-119 OracleTimeStampLTZ 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 OracleTimeStampLTZ 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 OracleTimeStampLTZ instance (Overloaded)

GetHashCode

Returns a hash code for the OracleTimeStampLTZ instance

GetDaysBetween

Subtracts an OracleTimeStampLTZ from the current instance and returns an OracleIntervalDS that represents the difference

GetYearsBetween

Subtracts an OracleTimeStampLTZ from the current instance and returns an OracleIntervalYM that represents the difference

GetType

Inherited from System.Object

ToOracleDate

Converts the current OracleTimeStampLTZ structure to an OracleDate structure

ToOracleTimeStamp

Converts the current OracleTimeStampLTZ structure to an OracleTimeStamp structure

ToOracleTimeStampTZ

Converts the current OracleTimeStampLTZ structure to an OracleTimeStampTZ structure

ToString

Converts the current OracleTimeStampLTZ structure to a string

ToUniversalTime

Converts the current local time to Coordinated Universal Time (UTC)


OracleTimeStampLTZ Constructors

The OracleTimeStampLTZ constructors create new instances of the OracleTimeStampLTZ structure.

Overload List:

  • OracleTimeStampLTZ(DateTime)

    This constructor creates a new instance of the OracleTimeStampLTZ structure and sets its value for date and time using the supplied DateTime value.

  • OracleTimeStampLTZ(string)

    This constructor creates a new instance of the OracleTimeStampLTZ structure and sets its value for date and time using the supplied string.

  • OracleTimeStampLTZ(int, int, int)

    This constructor creates a new instance of the OracleTimeStampLTZ structure and sets its value for date using year, month, and day.

  • OracleTimeStampLTZ(int, int, int, int, int, int)

    This constructor creates a new instance of the OracleTimeStampLTZ structure and sets its value for date and time using year, month, day, hour, minute, and second.

  • OracleTimeStampLTZ(int, int, int, int, int, int, double)

    This constructor creates a new instance of the OracleTimeStampLTZ structure and sets its value for date and time using year, month, day, hour, minute, second, and millisecond.

  • OracleTimeStampLTZ(int, int, int, int, int, int, int)

    This constructor creates a new instance of the OracleTimeStampLTZ structure and sets its value for date and time using year, month, day, hour, minute, second, and nanosecond.

  • OracleTimeStampLTZ(byte [ ])

    This constructor creates a new instance of the OracleTimeStampLTZ structure and sets its value to the provided byte array, which is in the internal Oracle TIMESTAMP WITH LOCAL TIME ZONE format.

OracleTimeStampLTZ(DateTime)

This constructor creates a new instance of the OracleTimeStampLTZ structure and sets its value for date and time using the supplied DateTime value.

Declaration

// C#
public OracleTimeStampLTZ (DateTime dt);

Parameters

  • dt

    The supplied DateTime value.

Exceptions

ArgumentException - The dt parameter cannot be used to construct a valid OracleTimeStampLTZ.

OracleTimeStampLTZ(string)

This constructor creates a new instance of the OracleTimeStampLTZ structure and sets its value for date and time using the supplied string.

Declaration

// C#
public OracleTimeStampLTZ(string tsStr);

Parameters

  • tsStr

    A string that represents an Oracle TIMESTAMP WITH LOCAL TIME ZONE.

Exceptions

ArgumentException - The tsStr is an invalid string representation of an Oracle TIMESTAMP WITH LOCAL TIME ZONE or the supplied tsStr is not in the timestamp format specified by the OracleGlobalization.TimeStampFormat property of the thread, which represents the Oracle NLS_TIMESTAMP_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 OracleTimeStampLTZSample
{
  static void Main()
  {
    // Set the nls_timestamp_format for the OracleTimeStampLTZ(string)
    // constructor
    OracleGlobalization info = OracleGlobalization.GetClientInfo();
    info.TimeStampFormat = "DD-MON-YYYY HH:MI:SS.FF AM";
    OracleGlobalization.SetThreadInfo(info);
    
    // construct OracleTimeStampLTZ from a string using the format
    // specified.
    OracleTimeStampLTZ ts = 
      new OracleTimeStampLTZ("11-NOV-1999 11:02:33.444 AM");
      
    // Set the nls_timestamp_format for the ToString() method
    info.TimeStampFormat = "YYYY-MON-DD HH:MI:SS.FF AM";
    OracleGlobalization.SetThreadInfo(info);
 
    // Prints "1999-NOV-11 11:02:33.444000000 AM"
    Console.WriteLine(ts.ToString());     
  }
}

OracleTimeStampLTZ(int, int, int)

This constructor creates a new instance of the OracleTimeStampLTZ structure and sets its value for date using year, month, and day.

Declaration

// C#
public OracleTimeStampLTZ(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 OracleTimeStampLTZ (that is, the day is out of range for the month).

OracleTimeStampLTZ(int, int, int, int, int, int)

This constructor creates a new instance of the OracleTimeStampLTZ structure and sets its value for date and time using year, month, day, hour, minute, and second.

Declaration

// C#
public OracleTimeStampLTZ (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 OracleTimeStampLTZ (that is, the day is out of range for the month).

OracleTimeStampLTZ(int, int, int, int, int, int, double)

This constructor creates a new instance of the OracleTimeStampLTZ structure and sets its value for date and time using year, month, day, hour, minute, second, and millisecond.

Declaration

// C#
public OracleTimeStampLTZ(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).

  • milliSeconds

    The milliseconds 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 OracleTimeStampLTZ (that is, the day is out of range for the month).

OracleTimeStampLTZ(int, int, int, int, int, int, int)

This constructor creates a new instance of the OracleTimeStampLTZ structure and sets its value for date and time using year, month, day, hour, minute, second, and nanosecond.

Declaration

// C#
public OracleTimeStampLTZ (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 OracleTimeStampLTZ (that is, the day is out of range for the month).

OracleTimeStampLTZ(byte [ ])

This constructor creates a new instance of the OracleTimeStampLTZ structure and sets its value to the provided byte array, which is in the internal Oracle TIMESTAMP WITH LOCAL TIME ZONE format.

Declaration

// C#
public OracleTimeStampLTZ (byte[] bytes);

Parameters

  • bytes

    A byte array that represents an Oracle TIMESTAMP WITH LOCAL TIME ZONE in Oracle internal format.

Exceptions

ArgumentException - bytes is not in an internal Oracle TIMESTAMP WITH LOCAL TIME ZONE format or bytes is not a valid Oracle TIMESTAMP WITH LOCAL TIME ZONE.

ArgumentNullException - bytes is null.

OracleTimeStampLTZ Static Fields

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

Table 14-120 OracleTimeStampLTZ Static Fields

Field Description

MaxValue

Represents the maximum valid date for an OracleTimeStampLTZ structure, which is December 31, 9999 23:59:59.999999999

MinValue

Represents the minimum valid date for an OracleTimeStampLTZ structure, which is January 1, -4712 0:0:0

Null

Represents a null value that can be assigned to an instance of the OracleTimeStampLTZ structure


MaxValue

This static field represents the maximum valid date for an OracleTimeStampLTZ structure, which is December 31, 9999 23:59:59.999999999.

Declaration

// C#
public static readonly OracleTimeStampLTZ MaxValue;

Remarks

This value is the maximum date and time in the client time zone.

MinValue

This static field represents the minimum valid date for an OracleTimeStampLTZ structure, which is January 1, -4712 0:0:0.

Declaration

// C#
public static readonly OracleTimeStampLTZ MinValue;

Remarks

This value is the minimum date and time in the client time zone.

Null

This static field represents a null value that can be assigned to an instance of the OracleTimeStampLTZ structure.

Declaration

// C#
public static readonly OracleTimeStampLTZ Null;

OracleTimeStampLTZ Static Methods

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

Table 14-121 OracleTimeStampLTZ Static Methods

Methods Description

Equals

Determines if two OracleTimeStampLTZ values are equal (Overloaded)

GetLocalTimeZoneName

Gets the client's local time zone name

GetLocalTimeZoneOffset

Gets the client's local time zone offset relative to UTC

GetSysDate

Gets an OracleTimeStampLTZ structure that represents the current date and time

GreaterThan

Determines if the first of two OracleTimeStampLTZ values is greater than the second

GreaterThanOrEqual

Determines if the first of two OracleTimeStampLTZ values is greater than or equal to the second

LessThan

Determines if the first of two OracleTimeStampLTZ values is less than the second

LessThanOrEqual

Determines if the first of two OracleTimeStampLTZ values is less than or equal to the second

NotEquals

Determines if two OracleTimeStampLTZ values are not equal

Parse

Gets an OracleTimeStampLTZ structure and sets its value for date and time using the supplied string

SetPrecision

Returns a new instance of an OracleTimeStampLTZ with the specified fractional second precision


Equals

This static method determines if two OracleTimeStampLTZ values are equal.

Declaration

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

Parameters

  • value1

    The first OracleTimeStampLTZ.

  • value2

    The second OracleTimeStampLTZ.

Return Value

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

Remarks

The following rules apply to the behavior of this method.

  • Any OracleTimeStampLTZ that has a value is greater than an OracleTimeStampLTZ that has a null value.

  • Two OracleTimeStampLTZs that contain a null value are equal.

GetLocalTimeZoneName

This static method gets the client's local time zone name.

Declaration

// C#
public static string GetLocalTimeZoneName(); 

Return Value

A string containing the local time zone.

GetLocalTimeZoneOffset

This static method gets the client's local time zone offset relative to Coordinated Universal Time (UTC).

Declaration

// C#
public static TimeSpan GetLocalTimeZoneOffset( );

Return Value

A TimeSpan structure containing the local time zone hours and time zone minutes.

GetSysDate

This static method gets an OracleTimeStampLTZ structure that represents the current date and time.

Declaration

// C#
public static OracleTimeStampLTZ GetSysDate();

Return Value

An OracleTimeStampLTZ structure that represents the current date and time.

GreaterThan

This static method determines if the first of two OracleTimeStampLTZ values is greater than the second.

Declaration

// C#
public static bool GreaterThan(OracleTimeStampLTZ value1, 
   OracleTimeStampLTZ value2);

Parameters

  • value1

    The first OracleTimeStampLTZ.

  • value2

    The second OracleTimeStampLTZ.

Return Value

Returns true if the first of two OracleTimeStampLTZ values is greater than the second; otherwise, returns false.

Remarks

The following rules apply to the behavior of this method.

  • Any OracleTimeStampLTZ that has a value is greater than an OracleTimeStampLTZ that has a null value.

  • Two OracleTimeStampLTZs that contain a null value are equal.

GreaterThanOrEqual

This static method determines if the first of two OracleTimeStampLTZ values is greater than or equal to the second.

Declaration

// C#
public static bool GreaterThanOrEqual(OracleTimeStampLTZ value1,
  OracleTimeStampLTZ value2);

Parameters

  • value1

    The first OracleTimeStampLTZ.

  • value2

    The second OracleTimeStampLTZ.

Return Value

Returns true if the first of two OracleTimeStampLTZ values is greater than or equal to the second; otherwise, returns false.

Remarks

The following rules apply to the behavior of this method.

  • Any OracleTimeStampLTZ that has a value is greater than an OracleTimeStampLTZ that has a null value.

  • Two OracleTimeStampLTZs that contain a null value are equal.

LessThan

This static method determines if the first of two OracleTimeStampLTZ values is less than the second.

Declaration

// C#
public static bool LessThan(OracleTimeStampLTZ value1, 
  OracleTimeStampLTZ value2);

Parameters

  • value1

    The first OracleTimeStampLTZ.

  • value2

    The second OracleTimeStampLTZ.

Return Value

Returns true if the first of two OracleTimeStampLTZ values is less than the second. Returns false otherwise.

Remarks

The following rules apply to the behavior of this method.

  • Any OracleTimeStampLTZ that has a value is greater than an OracleTimeStampLTZ that has a null value.

  • Two OracleTimeStampLTZs that contain a null value are equal.

LessThanOrEqual

This static method determines if the first of two OracleTimeStampLTZ values is less than or equal to the second.

Declaration

// C#
public static bool LessThanOrEqual(OracleTimeStampLTZ value1, 
  OracleTimeStampLTZ value2);

Parameters

  • value1

    The first OracleTimeStampLTZ.

  • value2

    The second OracleTimeStampLTZ.

Return Value

Returns true if the first of two OracleTimeStampLTZ values is less than or equal to the second. Returns false otherwise.

Remarks

The following rules apply to the behavior of this method.

  • Any OracleTimeStampLTZ that has a value is greater than an OracleTimeStampLTZ that has a null value.

  • Two OracleTimeStampLTZs that contain a null value are equal.

NotEquals

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

Declaration

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

Parameters

  • value1

    The first OracleTimeStampLTZ.

  • value2

    The second OracleTimeStampLTZ.

Return Value

Returns true if two OracleTimeStampLTZ values are not equal. Returns false otherwise.

Remarks

The following rules apply to the behavior of this method.

  • Any OracleTimeStampLTZ that has a value is greater than an OracleTimeStampLTZ that has a null value.

  • Two OracleTimeStampLTZs that contain a null value are equal.

Parse

This static method creates an OracleTimeStampLTZ structure and sets its value using the supplied string.

Declaration

// C#
public static OracleTimeStampLTZ Parse(string tsStr);

Parameters

  • tsStr

    A string that represents an Oracle TIMESTAMP WITH LOCAL TIME ZONE.

Return Value

An OracleTimeStampLTZ structure.

Exceptions

ArgumentException - The tsStr parameter is an invalid string representation of an Oracle TIMESTAMP WITH LOCAL TIME ZONE or the tsStr is not in the timestamp format specified by the OracleGlobalization.TimeStampFormat property of the thread, which represents the Oracle NLS_TIMESTAMP_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.Types;
using Oracle.DataAccess.Client;
 
class ParseSample
{
  static void Main()
  {
    // Set the nls_timestamp_format for the Parse() method
    OracleGlobalization info = OracleGlobalization.GetClientInfo();
    info.TimeStampFormat = "DD-MON-YYYY HH:MI:SS.FF AM";
    OracleGlobalization.SetThreadInfo(info);
    
    // construct OracleTimeStampLTZ from a string using the format specified.
    OracleTimeStampLTZ ts = 
      OracleTimeStampLTZ.Parse("11-NOV-1999 11:02:33.444 AM");
      
    // Set the nls_timestamp_format for the ToString() method
    info.TimeStampFormat = "YYYY-MON-DD HH:MI:SS.FF AM";
    OracleGlobalization.SetThreadInfo(info);
 
    // Prints "1999-NOV-11 11:02:33.444000000 AM"
    Console.WriteLine(ts.ToString());     
  }
}

SetPrecision

This static method returns a new instance of an OracleTimeStampLTZ with the specified fractional second precision.

Declaration

// C#
public static OracleTimeStampLTZ SetPrecision(OracleTimeStampLTZ value1,
     int fracSecPrecision);

Parameters

  • value1

    The provided OracleTimeStampLTZ object.

  • fracSecPrecision

    The fractional second precision provided. Range of fractional second precision is (0 to 9).

Return Value

An OracleTimeStampLTZ structure with the specified fractional second precision

Exceptions

ArgumentOutOfRangeException - fracSecPrecision is out of the specified range.

Remarks

The value specified in the supplied fracSecPrecision parameter is used to perform a rounding off operation on the supplied OracleTimeStampLTZ value. Depending on this value, 0 or more trailing zeros are displayed in the string returned by ToString().

Example

The OracleTimeStampLTZ with a value of "December 31, 9999 23:59:59.99" results in the string "December 31, 9999 23:59:59.99000" when SetPrecision() is called with the fractional second precision set to 5.

OracleTimeStampLTZ Static Operators

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

Table 14-122 OracleTimeStampLTZ Static Operators

Operator Description

operator +

Adds the supplied instance value to the supplied OracleTimeStampLTZ and returns a new OracleTimeStampLTZ structure (Overloaded)

operator ==

Determines if two OracleTimeStampLTZ values are equal

operator >

Determines if the first of two OracleTimeStampLTZ values is greater than the second

operator >=

Determines if the first of two OracleTimeStampLTZ values is greater than or equal to the second

operator !=

Determines if two OracleTimeStampLTZ values are not equal

operator <

Determines if the first of two OracleTimeStampLTZ values is less than the second

operator <=

Determines if the first of two OracleTimeStampLTZ values is less than or equal to the second

operator -

Subtracts the supplied instance value from the supplied OracleTimeStampLTZ and returns a new OracleTimeStampLTZ structure (Overloaded)


operator +

operator + adds the supplied value to the supplied OracleTimeStampLTZ and returns a new OracleTimeStampLTZ structure.

Overload List:

operator + (OracleTimeStampLTZ, OracleIntervalDS)

This static operator adds the supplied OracleIntervalDS to the supplied OracleTimeStampLTZ and returns a new OracleTimeStampLTZ structure.

Declaration

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

Parameters

  • value1

    An OracleTimeStampLTZ.

  • value2

    An OracleIntervalDS.

Return Value

An OracleTimeStampLTZ.

Remarks

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

operator + (OracleTimeStampLTZ, OracleIntervalYM)

This static operator adds the supplied OracleIntervalYM to the supplied OracleTimeStampLTZ and returns a new OracleTimeStampLTZ structure.

Declaration

// C#
public static operator +(OracleTimeStampLTZ value1, 
  OracleIntervalYM value2);

Parameters

  • value1

    An OracleTimeStampLTZ.

  • value2

    An OracleIntervalYM.

Return Value

An OracleTimeStampLTZ.

Remarks

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

operator + (OracleTimeStampLTZ, TimeSpan)

This static operator adds the supplied TimeSpan to the supplied OracleTimeStampLTZ and returns a new OracleTimeStampLTZ structure.

Declaration

// C#
public static operator +(OracleTimeStampLTZ value1, TimeSpan value2);

Parameters

  • value1

    An OracleTimeStampLTZ.

  • value2

    A TimeSpan.

Return Value

An OracleTimeStampLTZ.

Remarks

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

operator ==

This static operator determines if two OracleTimeStampLTZ values are equal.

Declaration

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

Parameters

  • value1

    The first OracleTimeStampLTZ.

  • value2

    The second OracleTimeStampLTZ.

Return Value

Returns true if they are the same; otherwise, returns false.

Remarks

The following rules apply to the behavior of this method.

  • Any OracleTimeStampLTZ that has a value is greater than an OracleTimeStampLTZ that has a null value.

  • Two OracleTimeStampLTZs that contain a null value are equal.

operator >

This static operator determines if the first of two OracleTimeStampLTZ values is greater than the second.

Declaration

// C#
public static bool operator > (OracleTimeStampLTZ value1, 
     OracleTimeStampLTZ value2);

Parameters

  • value1

    The first OracleTimeStampLTZ.

  • value2

    The second OracleTimeStampLTZ.

Return Value

Returns true if the first OracleTimeStampLTZ value is greater than the second; otherwise, returns false.

Remarks

The following rules apply to the behavior of this method.

  • Any OracleTimeStampLTZ that has a value is greater than an OracleTimeStampLTZ that has a null value.

  • Two OracleTimeStampLTZs that contain a null value are equal.

operator >=

This static operator determines if the first of two OracleTimeStampLTZ values is greater than or equal to the second.

Declaration

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

Parameters

  • value1

    An OracleTimeStampLTZ.

  • value2

    The second OracleTimeStampLTZ.

Return Value

Returns true if the first OracleTimeStampLTZ is greater than or equal to the second; otherwise, returns false.

Remarks

The following rules apply to the behavior of this method.

  • Any OracleTimeStampLTZ that has a value is greater than an OracleTimeStampLTZ that has a null value.

  • Two OracleTimeStampLTZs that contain a null value are equal.

operator !=

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

Declaration

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

Parameters

  • value1

    The first OracleTimeStampLTZ.

  • value2

    The second OracleTimeStampLTZ.

Return Value

Returns true if two OracleTimeStampLTZ values are not equal; otherwise returns false.

Remarks

The following rules apply to the behavior of this method.

  • Any OracleTimeStampLTZ that has a value is greater than an OracleTimeStampLTZ that has a null value.

  • Two OracleTimeStampLTZs that contain a null value are equal.

operator <

This static operator determines if the first of two OracleTimeStampLTZ values is less than the second.

Declaration

// C#
public static bool operator < (OracleTimeStampLTZ value1, 
     OracleTimeStampLTZ value2);

Parameters

  • value1

    The first OracleTimeStampLTZ.

  • value2

    The second OracleTimeStampLTZ.

Return Value

Returns true if the first OracleTimeStampLTZ is less than the second; otherwise, returns false.

Remarks

The following rules apply to the behavior of this method.

  • Any OracleTimeStampLTZ that has a value is greater than an OracleTimeStampLTZ that has a null value.

  • Two OracleTimeStampLTZs that contain a null value are equal.

operator <=

This static operator determines if the first of two OracleTimeStampLTZ values is less than or equal to the second.

Declaration

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

Parameters

  • value1

    The first OracleTimeStampLTZ.

  • value2

    The second OracleTimeStampLTZ.

Return Value

Returns true if the first OracleTimeStampLTZ is less than or equal to the second; otherwise, returns false.

Remarks

The following rules apply to the behavior of this method.

  • Any OracleTimeStampLTZ that has a value is greater than an OracleTimeStampLTZ that has a null value.

  • Two OracleTimeStampLTZs that contain a null value are equal.

operator -

operator- subtracts the supplied value, from the supplied OracleTimeStampLTZ value, and returns a new OracleTimeStampLTZ structure.

Overload List:

operator - (OracleTimeStampLTZ, OracleIntervalDS)

This static operator subtracts the supplied OracleIntervalDS value, from the supplied OracleTimeStampLTZ value, and return a new OracleTimeStampLTZ structure.

Declaration

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

Parameters

  • value1

    An OracleTimeStampLTZ.

  • value2

    An OracleIntervalDS instance.

Return Value

An OracleTimeStampLTZ structure.

Remarks

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

operator - (OracleTimeStampLTZ, OracleIntervalYM)

This static operator subtracts the supplied OracleIntervalYM value, from the supplied OracleTimeStampLTZ value, and returns a new OracleTimeStampLTZ structure.

Declaration

// C#
public static operator - (OracleTimeStampLTZ value1, 
  OracleIntervalYM value2);

Parameters

  • value1

    An OracleTimeStampLTZ.

  • value2

    An OracleIntervalYM.

Return Value

An OracleTimeStampLTZ structure.

Remarks

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

operator - (OracleTimeStampLTZ, TimeSpan)

This static operator subtracts the supplied TimeSpan value, from the supplied OracleTimeStampLTZ value, and returns a new OracleTimeStampLTZ structure.

Declaration

// C#
public static operator -(OracleTimeStampLTZ value1, TimeSpan value2);

Parameters

  • value1

    An OracleTimeStampLTZ.

  • value2

    A TimeSpan.

Return Value

An OracleTimeStampLTZ structure.

Remarks

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

OracleTimeStampLTZ Static Type Conversions

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

Table 14-123 OracleTimeStampLTZ Static Type Conversions

Operator Description

explicit operator OracleTimeStampLTZ

Converts an instance value to an OracleTimeStampLTZ structure (Overloaded)

implicit operator OracleTimeStampLTZ

Converts an instance value to an OracleTimeStampLTZ structure (Overloaded)

explicit operator DateTime

Converts an OracleTimeStampLTZ value to a DateTime structure


explicit operator OracleTimeStampLTZ

explicit operator OracleTimeStampLTZ converts the supplied value to an OracleTimeStampLTZ structure.

Overload List:

explicit operator OracleTimeStampLTZ(OracleTimeStamp)

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

Declaration

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

Parameters

  • value1

    An OracleTimeStamp.

Return Value

The OracleTimeStampLTZ structure contains the date and time of the OracleTimeStampTZ structure.

Remarks

If the OracleTimeStamp structure has a null value, the returned OracleTimeStampLTZ structure also has a null value.

explicit operator OracleTimeStampLTZ(OracleTimeStampTZ)

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

Declaration

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

Parameters

  • value1

    An OracleTimeStampTZ instance.

Return Value

The OracleTimeStampLTZ structure contains the date and time in the OracleTimeStampTZ structure (which is normalized to the client local time zone).

Remarks

If the OracleTimeStampTZ structure has a null value, the returned OracleTimeStampLTZ structure also has a null value.

explicit operator OracleTimeStampLTZ(string)

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

Declaration

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

Parameters

  • tsStr

    A string representation of an Oracle TIMESTAMP WITH LOCAL TIME ZONE.

Return Value

A OracleTimeStampLTZ.

Exceptions

ArgumentException - ThetsStr parameter is an invalid string representation of an Oracle TIMESTAMP WITH LOCAL TIME ZONE or the tsStr is not in the timestamp format specified by the thread's OracleGlobalization.TimeStampFormat property, which represents the Oracle NLS_TIMESTAMP_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.Types;
using Oracle.DataAccess.Client;
 
class OracleTimeStampLTZSample
{
  static void Main()
  {
    // Set the nls_timestamp_format for the OracleTimeStampLTZ(string)
    // constructor
    OracleGlobalization info = OracleGlobalization.GetClientInfo();
    info.TimeStampFormat = "DD-MON-YYYY HH:MI:SS.FF AM";
    OracleGlobalization.SetThreadInfo(info);
    
    // construct OracleTimeStampLTZ from a string using the format specified.
    OracleTimeStampLTZ ts = 
      new OracleTimeStampLTZ("11-NOV-1999 11:02:33.444 AM");
    
    // Set the nls_timestamp_format for the ToString() method
    info.TimeStampFormat = "YYYY-MON-DD HH:MI:SS.FF AM";
    OracleGlobalization.SetThreadInfo(info);
 
    // Prints "1999-NOV-11 11:02:33.444000000 AM"
    Console.WriteLine(ts.ToString()); 
  }
}

implicit operator OracleTimeStampLTZ

implicit operator OracleTimeStampLTZ converts the supplied structure to an OracleTimeStampLTZ structure.

Overload List:

implicit operator OracleTimeStampLTZ(OracleDate)

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

Declaration

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

Parameters

  • value1

    An OracleDate.

Return Value

The returned OracleTimeStampLTZ structure contains the date and time in the OracleDate structure.

Remarks

If the OracleDate structure has a null value, the returned OracleTimeStampLTZ structure also has a null value.

implicit operator OracleTimeStampLTZ(DateTime)

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

Declaration

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

Parameters

  • value1

    A DateTime structure.

Return Value

An OracleTimeStampLTZ structure.

explicit operator DateTime

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

Declaration

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

Parameters

  • value1

    An OracleTimeStampLTZ instance.

Return Value

A DateTime that contains the date and time in the current instance.

Exceptions

OracleNullValueException - The OracleTimeStampLTZ structure has a null value.

Remarks

The precision of the OracleTimeStampLTZ value can be lost during the conversion.

OracleTimeStampLTZ Properties

The OracleTimeStampLTZ properties are listed in Table 14-124.

Table 14-124 OracleTimeStampLTZ Properties

Properties Description

BinData

Returns an array of bytes that represents an Oracle TIMESTAMP WITH LOCAL TIME ZONE in Oracle internal format

Day

Specifies the day component of an OracleTimeStampLTZ

IsNull

Indicates whether or not the OracleTimeStampLTZ instance has a null value

Hour

Specifies the hour component of an OracleTimeStampLTZ

Millisecond

Specifies the millisecond component of an OracleTimeStampLTZ

Minute

Specifies the minute component of an OracleTimeStampLTZ

Month

Specifies the month component of an OracleTimeStampLTZ

Nanosecond

Specifies the nanosecond component of an OracleTimeStampLTZ

Second

Specifies the second component of an OracleTimeStampLTZ

Value

Specifies the date and time that is stored in the OracleTimeStampLTZ structure

Year

Specifies the year component of an OracleTimeStampLTZ


BinData

This property returns an array of bytes that represents an Oracle TIMESTAMP WITH LOCAL TIME ZONE in Oracle internal format.

Declaration

// C#
public byte[] BinData {get;}

Property Value

A byte array that represents an Oracle TIMESTAMP WITH LOCAL TIME ZONE internal format.

Exceptions

OracleNullValueException - The current instance has a null value.

Day

This property specifies the day component of an OracleTimeStampLTZ.

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 contains a null value; otherwise, returns false.

Hour

This property specifies the hour component of an OracleTimeStampLTZ.

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 OracleTimeStampLTZ.

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 OracleTimeStampLTZ.

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 OracleTimeStampLTZ.

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 OracleTimeStampLTZ.

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 OracleTimeStampLTZ.

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.

Value

This property specifies the date and time that is stored in the OracleTimeStampLTZ structure.

Declaration

// C#
public DateTime Value{get;}

Property Value

A DateTime.

Exceptions

OracleNullValueException - The current instance has a null value.

Year

This property gets the year component of an OracleTimeStampLTZ.

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.

OracleTimeStampLTZ Methods

The OracleTimeStampLTZ methods are listed in Table 14-125.

Table 14-125 OracleTimeStampLTZ 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 OracleTimeStampLTZ 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 OracleTimeStampLTZ instance (Overloaded)

GetHashCode

Returns a hash code for the OracleTimeStampLTZ instance

GetDaysBetween

Subtracts an OracleTimeStampLTZ from the current instance and returns an OracleIntervalDS that represents the difference

GetYearsBetween

Subtracts an OracleTimeStampLTZ from the current instance and returns an OracleIntervalYM that represents the difference

GetType

Inherited from System.Object

ToOracleDate

Converts the current OracleTimeStampLTZ structure to an OracleDate structure

ToOracleTimeStamp

Converts the current OracleTimeStampLTZ structure to an OracleTimeStamp structure

ToOracleTimeStampTZ

Converts the current OracleTimeStampLTZ structure to an OracleTimeStampTZ structure

ToString

Converts the current OracleTimeStampLTZ structure to a string

ToUniversalTime

Converts the current local time to Coordinated Universal Time (UTC)


AddDays

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

Declaration

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

Parameters

  • days

    The supplied number of days. Range is (-1,000,000,000 < days < 1,000,000,000)

Return Value

An OracleTimeStampLTZ.

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 OracleTimeStampLTZ AddHours(double hours);

Parameters

  • hours

    The supplied number of hours. Range is (-24,000,000,000 < hours < 24,000,000,000).

Return Value

An OracleTimeStampLTZ.

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 OracleTimeStampLTZ AddMilliseconds(double milliseconds);

Parameters

  • milliseconds

    The supplied number of milliseconds. Range is (-8.64 * 1016< milliseconds < 8.64 * 1016).

Return Value

An OracleTimeStampLTZ.

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 OracleTimeStampLTZ 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 OracleTimeStampLTZ.

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 OracleTimeStampLTZ AddMonths(long months);

Parameters

  • months

    The supplied number of months. Range is (-12,000,000,000 < months < 12,000,000,000).

Return Value

An OracleTimeStampLTZ.

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 OracleTimeStampLTZ AddNanoseconds(long nanoseconds);

Parameters

  • nanoseconds

    The supplied number of nanoseconds.

Return Value

An OracleTimeStampLTZ.

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 OracleTimeStampLTZ AddSeconds(double seconds);

Parameters

  • seconds

    The supplied number of seconds. Range is (-8.64 * 1013< seconds < 8.64 * 1013).

Return Value

An OracleTimeStampLTZ.

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 OracleTimeStampLTZ AddYears(int years);

Parameters

  • years

    The supplied number of years. Range is (-999,999,999 <= years < = 999,999,999)

Return Value

An OracleTimeStampLTZ.

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 OracleTimeStampLTZ 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 OracleTimeStampLTZ instance.

Return Value

The method returns a number that is:

  • Less than zero: if the current OracleTimeStampLTZ instance value is less than that of obj.

  • Zero: if the current OracleTimeStampLTZ instance and obj values are equal.

  • Greater than zero: if the current OracleTimeStampLTZ instance value is greater than that of obj.

Implements

IComparable

Exceptions

ArgumentException - The obj parameter is not of type OracleTimeStampLTZ.

Remarks

The following rules apply to the behavior of this method.

  • The comparison must be between OracleTimeStampLTZs. For example, comparing an OracleTimeStampLTZ instance with an OracleBinary instance is not allowed. When an OracleTimeStampLTZ is compared with a different type, an ArgumentException is thrown.

  • Any OracleTimeStampLTZ that has a value is greater than an OracleTimeStampLTZ that has a null value.

  • Two OracleTimeStampLTZs that contain a null value are equal.

Equals

Overrides Object

This method determines whether or not an object has the same date and time as the current OracleTimeStampLTZ instance.

Declaration

// C#
public override bool Equals(object obj);

Parameters

  • obj

    The object being compared to the current OracleTimeStampLTZ instance.

Return Value

Returns true if the obj is of type OracleTimeStampLTZ and represents the same date and time; otherwise, returns false.

Remarks

The following rules apply to the behavior of this method.

  • Any OracleTimeStampLTZ that has a value is greater than an OracleTimeStampLTZ that has a null value.

  • Two OracleTimeStampLTZs that contain a null value are equal.

GetHashCode

Overrides Object

This method returns a hash code for the OracleTimeStampLTZ instance.

Declaration

// C#
public override int GetHashCode();

Return Value

A number that represents the hash code.

GetDaysBetween

This method subtracts an OracleTimeStampLTZ value from the current instance and returns an OracleIntervalDS that represents the difference.

Declaration

// C#
public OracleIntervalDS GetDaysBetween(OracleTimeStampLTZ value1);

Parameters

  • value1

    The OracleTimeStampLTZ value being subtracted.

Return Value

An OracleIntervalDS that represents the interval between two OracleTimeStampLTZ values.

Remarks

If either the current instance or the parameter has a null value, the returned OracleIntervalDS has a null value.

GetYearsBetween

This method subtracts an OracleTimeStampLTZ value from the current instance and returns an OracleIntervalYM that represents the time interval.

Declaration

// C#
public OracleIntervalYM GetYearsBetween(OracleTimeStampLTZ value1);

Parameters

  • value1

    The OracleTimeStampLTZ value being subtracted.

Return Value

An OracleIntervalYM that represents the interval between two OracleTimeStampLTZ values.

Remarks

If either the current instance or the parameter has a null value, the returned OracleIntervalYM has a null value.

ToOracleDate

This method converts the current OracleTimeStampLTZ structure to an OracleDate structure.

Declaration

// C#
public OracleDate ToOracleDate();

Return Value

The returned OracleDate structure contains the date and time in the current instance.

Remarks

The precision of the OracleTimeStampLTZ value can be lost during the conversion.

If the current instance has a null value, the value of the returned OracleDate structure has a null value.

ToOracleTimeStamp

This method converts the current OracleTimeStampLTZ structure to an OracleTimeStamp structure.

Declaration

// C#
public OracleTimeStamp ToOracleTimeStamp();

Return Value

The returned OracleTimeStamp contains the date and time in the current instance.

Remarks

If the current instance has a null value, the value of the returned OracleTimeStamp structure has a null value.

ToOracleTimeStampTZ

This method converts the current OracleTimeStampLTZ structure to an OracleTimeStampTZ structure.

Declaration

// C#
public OracleTimeStampTZ ToOracleTimeStampTZ();

Return Value

The returned OracleTimeStampTZ contains the date and time of the current instance, with the time zone set to the OracleGlobalization.TimeZone from the thread.

Remarks

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

ToString

Overrides Object

This method converts the current OracleTimeStampLTZ structure to a string.

Declaration

// C#
public override string ToString();

Return Value

A string that represents the same date and time as the current OracleTimeStampLTZ structure.

Remarks

The returned value is a string representation of the OracleTimeStampLTZ in the format specified by the OracleGlobalization.TimeStampFormat property of the thread.

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.Types;
using Oracle.DataAccess.Client;
 
class ToStringSample
{
  static void Main()
  {
    // Set the nls_timestamp_format for the OracleTimeStampLTZ(string)
    // constructor
    OracleGlobalization info = OracleGlobalization.GetClientInfo();
    info.TimeStampFormat = "DD-MON-YYYY HH:MI:SS.FF AM";
    OracleGlobalization.SetThreadInfo(info);
    
    // construct OracleTimeStampLTZ from a string using the format
    // specified.
    OracleTimeStampLTZ ts = 
      new OracleTimeStampLTZ("11-NOV-1999 11:02:33.444 AM");
      
    // Set the nls_timestamp_format for the ToString() method
    info.TimeStampFormat = "YYYY-MON-DD HH:MI:SS.FF AM";
    OracleGlobalization.SetThreadInfo(info);
 
    // Prints "1999-NOV-11 11:02:33.444000000 AM"
    Console.WriteLine(ts.ToString());     
  }
}

ToUniversalTime

This method converts the current local time 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.