Sometimes you have to pull a date from Oracle in a cleaner format, this is one way to achieve the format you want.
// Convert the Oracle date 19000101 to 01-01-1900
public string OracleCleanDate(string strDate)
{
if (strDate.Length == 8)
{
string strYear, strMonth, strDay;
strYear = strDate.Substring(0, 4);
strMonth = strDate.Substring(4, 2);
strDay = strDate.Substring(6, 2);
strDate = strMonth + "-" + strDay + "-" + strYear;
}
return strDate;
}
Originally Posted on September 18, 2013
Last Updated on October 26, 2015
Last Updated on October 26, 2015
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.