Currently, developers must provide
date format whenever inserting date records into oracle. Here is one approach:
date format whenever inserting date records into oracle. Here is one approach:
public static DateTime FormatDateForOracle(string inDate)
{
//try to parse date into the acceptable Oracle format
DateTime parsedDate;
if (DateTime.TryParse(inDate,
out parsedDate))
out parsedDate))
{
try
{
return parsedDate = DateTime.ParseExact(Convert.ToDateTime(inDate).ToString(“MM/dd/yyyy”), “MM/dd/yyyy”,
System.Globalization.CultureInfo.InvariantCulture);
System.Globalization.CultureInfo.InvariantCulture);
}
catch (Exception
e)
e)
{
//Handle as you see fit
}
}
else
{
//Handle as you see fit
}
return
parsedDate;
parsedDate;
}