OracleTimeStamp Structure

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

Class Inheritance

System.Object

System.ValueType

Oracle.DataAccess.Types.OracleTimeStamp

Declaration

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

Requirements

Provider ODP.NET, Unmanaged Driver ODP.NET, Managed Driver ODP.NET Core
Assembly Oracle.DataAccess.dll Oracle.ManagedDataAccess.dll Oracle.ManagedDataAccess.dll
Namespace Oracle.DataAccess.Client Oracle.ManagedDataAccess.Client Oracle.ManagedDataAccess.Client
.NET Framework See System Requirements See System Requirements -
.NET (Core) - - See System Requirements

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;

class OracleTimeStampSample
{
  static void Main()
  {
    OracleTimeStamp tsCurrent1 = OracleTimeStamp.GetSysDate();
    OracleTimeStamp tsCurrent2 = DateTime.Now;

    // Calculate the difference between tsCurrent1 and tsCurrent2
    OracleIntervalDS idsDiff = tsCurrent2.GetDaysBetween(tsCurrent1);

    // Calculate the difference using AddNanoseconds()
    int nanoDiff = 0;
    while (tsCurrent2 > tsCurrent1)
    {
      nanoDiff += 10;
      tsCurrent1 = tsCurrent1.AddNanoseconds(10);
    }
    Console.WriteLine("idsDiff.Nanoseconds = " + idsDiff.Nanoseconds);
    Console.WriteLine("nanoDiff = " + nanoDiff);
  }
}

See Also: