ToString
ValueType
をオーバーライドします
このメソッドにより、現行のOracleDate
構造がstring
に変換されます。
宣言
// C# public override string ToString();
戻り値
string。
備考
戻された値は、スレッドのOracleGlobalization
.DateFormat
プロパティで指定された書式における、OracleDate
の文字列表現です。月および日付に使用されている名称および略称は、スレッドのOracleGlobalization
.DateLanguage
およびOracleGlobalization.Calendar
プロパティで指定されている言語による表記です。スレッドのグローバリゼーション・プロパティのいずれかがNULLまたは空の文字列に設定されている場合、クライアントのコンピュータの設定が使用されます。
例
// C# using System; using Oracle.DataAccess.Client; using Oracle.DataAccess.Types; class ToStringSample { static void Main(string[] args) { // Set the thread's DateFormat to a specific format OracleGlobalization info = OracleGlobalization.GetClientInfo(); info.DateFormat = "YYYY-MON-DD"; OracleGlobalization.SetThreadInfo(info); // Construct OracleDate from a string using the DateFormat specified OracleDate date = (OracleDate)"1999-DEC-01"; // Set a different DateFormat on the thread for ToString() info.DateFormat = "YYYY/MM/DD"; OracleGlobalization.SetThreadInfo(info); // Prints "1999/12/01" Console.WriteLine(date.ToString()); } }