Example #1
0
File: Cf.cs Project: yorigum/isc064
        public static string Periode(object r1, object r2)
        {
            if (r1 is DBNull || r2 is DBNull)
            {
                return("");
            }
            else
            {
                DateTime x1 = Convert.ToDateTime(r1);
                DateTime x2 = Convert.ToDateTime(r2);

                if (x1 == x2)
                {
                    return(Cf.Day(x1));
                }
                else
                {
                    string s1 = "";
                    string s2 = "";

                    if (x1.Day != 1)
                    {
                        s1 = x1.Day + " " + Cf.Month(x1);
                    }
                    else
                    {
                        s1 = Cf.Month(x1);
                    }

                    if (x2.Day != AkhirBulan(x2.Month, x2.Year).Day)
                    {
                        s2 = x2.Day + " " + Cf.Month(x2);
                    }
                    else
                    {
                        s2 = Cf.Month(x2);
                    }

                    return(s1 + " - " + s2);
                }
            }
        }