explicit operator OracleTimeStamp(string)
この静的な型変換演算子は、指定された文字列をOracleTimeStamp構造に変換します。
宣言
// C#
public static explicit operator OracleTimeStamp(string tsStr);パラメータ
-
tsStrOracle
TIMESTAMPの文字列表現
戻り値
OracleTimeStamp。
例外
ArgumentException - tsStrがOracle TIMESTAMPの無効な文字列表現か、tsStrが、スレッドのOracleGlobalization.TimeStampFormatプロパティで指定されたタイムスタンプの形式ではありません。このプロパティは、Oracle NLS_TIMESTAMP_FORMATパラメータを表します。
備考
月および日付に使用されている名称および略称は、スレッドのOracleGlobalizationオブジェクトのDateLanguageおよびCalendarプロパティで指定されている言語による表記です。スレッドのグローバリゼーション・プロパティのいずれかがNULLまたは空の文字列に設定されている場合、クライアントのコンピュータの設定が使用されます。
例
// C#
using System;
using Oracle.DataAccess.Types;
using Oracle.DataAccess.Client;
class OracleTimeStampSample
{
static void Main()
{
// Set the nls_timestamp_format for the explicit
// operator OracleTimeStamp(string)
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 = new OracleTimeStamp("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());
}
}