public static string FormatDate(string dt, Huron.HuronEnums.DateType inputDtFormat, Huron.HuronEnums.DateType outputDtFormat, Huron.HuronEnums.ScalarDateType scalarDt)
        {
            string s = scalarDt.ToString().Substring(1);

            s = s.Substring(0, 4) + "/" + s.Substring(4, 2) + "/" + s.Substring(6);
            return(DateRoutine(dt, inputDtFormat, outputDtFormat, "", s));
        }
        //Returna a date based on date,input, and output information.
        private static string DateRoutine(string dt, Huron.HuronEnums.DateType inputDateFormat, Huron.HuronEnums.DateType outputDateFormat, string ind, string scalarDt)
        {
            string   day      = "";
            string   month    = "";
            string   year     = "";
            string   yr       = "";
            string   returnDt = "";
            double   a        = 0;
            DateTime dateTime;

            dt  = dt.Trim();
            ind = ind.Trim();

            if (inputDateFormat.ToString() == "mmddyy")
            {
                dt = Right(dt, 6);
                yr = Right(dt, 2);
                if (ind == "")
                {
                    if (yr == "00" || yr == "01" || yr == "02" || yr == "03" || yr == "04" || yr == "05")
                    {
                        ind = "20";
                    }
                }
            }
            if (inputDateFormat.ToString() == "yyyymmdd" || inputDateFormat.ToString() == "mmddyyyy")
            {
                dt = Right(dt, 8);
            }
            if (dt == "" || dt == "//" || dt == "000000" || dt == "00000000" || dt == "00000")
            {
                return("");
            }
            if (ind == "00" || ind == "0" || ind == "18" || ind == "018")
            {
                ind = "18";
            }
            else if (ind == "01" || ind == "1" || ind == "19" || ind == "019" || ind == "")
            {
                ind = "19";
            }
            else if (ind == "02" || ind == "2" || ind == "20" || ind == "020")
            {
                ind = "20";
            }
            else
            {
                ind = "";
            }

            if (inputDateFormat.ToString() == "mmddyy" || inputDateFormat.ToString() == "mmddyyyy")
            {
                if (dt.Length == 6)
                {
                    dt = dt.Substring(0, 2) + "/" + dt.Substring(2, 2) + "/" + ind + dt.Substring(4);
                }
                else if (dt.Length > 6)
                {
                    dt = dt.Substring(0, 2) + "/" + dt.Substring(2, 2) + "/" + dt.Substring(4);
                }
            }
            else if (inputDateFormat.ToString() == "yyyymmdd")
            {
                if (dt.Length >= 8)
                {
                    dt = dt.Substring(0, 4) + "/" + dt.Substring(4, 2) + "/" + dt.Substring(6);
                }
            }
            else if (inputDateFormat.ToString() == "mmddyySlash" || inputDateFormat.ToString() == "mmddyyDash")
            {
                if (dt.Length == 8)
                {
                    dt = dt.Substring(0, 6) + ind + dt.Substring(6, 2);
                }
            }
            else if (inputDateFormat.ToString() == "scalarDate")
            {
                a = double.Parse(dt);
                DateTime beginDt = DateTime.Parse(scalarDt);
                DateTime answer  = beginDt.AddDays(a);

                day   = string.Format("{0:00}", answer.Day);
                month = string.Format("{0:00}", answer.Month);
                year  = answer.Year.ToString();
                dt    = month + "/" + day + "/" + year;
            }

            if (IsDate(dt) == true)
            {
                dateTime = DateTime.Parse(dt);
                day      = string.Format("{0:00}", dateTime.Day);
                month    = string.Format("{0:00}", dateTime.Month);
                year     = string.Format("{0:00}", dateTime.Year);
            }
            else
            {
                return("");
            }
            returnDt = OutputDate(outputDateFormat, month, day, year, scalarDt);
            return(returnDt);
        }
        private static string OutputDate(Huron.HuronEnums.DateType output, string m, string d, string y, string sDt)
        {
            string outDt = "";

            string[]     array;
            string       abrMonth    = Huron.HuronEnums.MonthAbbrs;
            string       fullMonth   = Huron.HuronEnums.MonthNames;
            const string defaultDate = "Dec 30, 1899";

            switch (output)
            {
            case Huron.HuronEnums.DateType.mmddyy:
                outDt = m + d + y.Substring(2);
                break;

            case Huron.HuronEnums.DateType.yyyymmdd:
                outDt = y + m + d;
                break;

            case Huron.HuronEnums.DateType.mmddyyyy:
                outDt = m + d + y;
                break;

            case Huron.HuronEnums.DateType.mmddyySlash:
                outDt = m + "/" + d + "/" + y.Substring(2);
                break;

            case Huron.HuronEnums.DateType.yyyymmddSlash:
                outDt = y + "/" + m + "/" + d;
                break;

            case Huron.HuronEnums.DateType.mmddyyyySlash:
                outDt = m + "/" + d + "/" + y;
                break;

            case Huron.HuronEnums.DateType.mmddyyDash:
                outDt = m + "-" + d + "-" + y.Substring(2);
                break;

            case Huron.HuronEnums.DateType.yyyymmddDash:
                outDt = y + "-" + m + "-" + d;
                break;

            case Huron.HuronEnums.DateType.mmddyyyyDash:
                outDt = m + "-" + d + "-" + y;
                break;

            case Huron.HuronEnums.DateType.abrMonDayYear:
                array = abrMonth.Split(',');
                outDt = array[int.Parse(m) - 1] + " " + int.Parse(d).ToString() + ", " + y;
                break;

            case Huron.HuronEnums.DateType.fullMonDayYear:
                array = fullMonth.Split(',');
                outDt = array[int.Parse(m) - 1] + " " + int.Parse(d).ToString() + ", " + y;
                break;

            case Huron.HuronEnums.DateType.scalarDate:
                if (sDt == "")
                {
                    sDt = defaultDate;
                }
                DateTime scalarDt = DateTime.Parse(sDt);
                DateTime dt       = DateTime.Parse(m + "/" + d + "/" + y);
                TimeSpan num      = dt.Subtract(scalarDt);
                outDt = int.Parse(num.TotalDays.ToString()).ToString();
                break;
            }
            return(outDt);
        }
        public static string FormatDate(string dt, Huron.HuronEnums.DateType inputDtFormat, Huron.HuronEnums.DateType outputDtFormat, DateTime scalarDt)
        {
            string s = scalarDt.Year + "/" + scalarDt.Month + "/" + scalarDt.Day;

            return(DateRoutine(dt, inputDtFormat, outputDtFormat, "", s));
        }
 /// <summary>
 /// Returns the date string.
 /// </summary>
 /// <param name="dt">Input date.</param>
 /// <param name="inputDtFormat">Input date format.</param>
 /// <param name="outputDtFormat">Output date format.</param>
 /// <param name="centIndicator">Century Indicator. Includes values 0,18,1,19,2,20.</param>
 /// <returns></returns>
 public static string FormatDate(string dt, Huron.HuronEnums.DateType inputDtFormat, Huron.HuronEnums.DateType outputDtFormat, string centIndicator)
 {
     return(DateRoutine(dt, inputDtFormat, outputDtFormat, centIndicator, ""));
 }
 public static string FormatDate(string dt, Huron.HuronEnums.DateType inputDtFormat, Huron.HuronEnums.DateType outputDtFormat)
 {
     return(DateRoutine(dt, inputDtFormat, outputDtFormat, "", ""));
 }