14.3.8.6 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()); 
  }
}