プライマリ・コンテンツに移動
Oracle® Data Provider for .NET開発者ガイド
ODAC 12.2c リリース1 (12.2.0.1) for Microsoft Windows
E88311-03
目次へ移動
目次
索引へ移動
索引

前
次

Parse

この静的メソッドは、OracleTimeStamp構造を取得し、指定された文字列を使用して値を設定します。

宣言

// C#
public static OracleTimeStamp Parse(string datetime);

パラメータ

  • datetime

    Oracle TIMESTAMPを表す文字列

戻り値

OracleTimeStamp構造。

例外

ArgumentException - tsStrがOracle TIMESTAMPの無効な文字列表現か、指定されたtsStrが、スレッドのOracleGlobalization.TimeStampFormatプロパティで指定されたタイムスタンプの形式ではありません。このプロパティは、Oracle NLS_TIMESTAMP_FORMATパラメータを表します。

ArgumentNullException - tsStr値はNULLです。

備考

月および日付に使用されている名称および略称は、スレッドのOracleGlobalizationオブジェクトのDateLanguageおよびCalendarプロパティで指定されている言語による表記です。スレッドのグローバリゼーション・プロパティのいずれかがNULLまたは空の文字列に設定されている場合、クライアントのコンピュータの設定が使用されます。

// 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 OracleTimeStamp from a string using the format specified.
    OracleTimeStamp ts = 
      OracleTimeStamp.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());    
  }
}