14.3.6.5 explicit operator OracleDate(string)
This method converts the supplied string to an OracleDate structure.
                  
Declaration
// C#
public explicit operator OracleDate (string dateStr);Parameters
- 
                        dateStrA string representation of an Oracle DATE.
Return Value
The returned OracleDate structure contains the date and time in the string dateStr.
                  
Exceptions
ArgumentNullException - The dateStr is null.
                  
ArgumentException - This exception is thrown if any of the following conditions exist:
                  
- 
                        The dateStris an invalid string representation of an OracleDATE.
- 
                        The dateStris not in the date format specified by the thread'sOracleGlobalization.DateFormatproperty, which represents the OracleNLS_DATE_FORMATparameter.
Remarks
The names and abbreviations used for months and days are in the language specified by the DateLanguage and Calendar properties of the thread's OracleGlobalization object. If any of the thread's globalization properties are set to null or an empty string, the client computer's settings are used.
                  
Example
// C#
 
using System;
using Oracle.DataAccess.Client;
using Oracle.DataAccess.Types;
 
class OracleDateSample
{
  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 = "MON DD YY";
    OracleGlobalization.SetThreadInfo(info);
 
    // Prints "DEC 01 99"
    Console.WriteLine(date.ToString()); 
  }
}