Parsi Coders

نسخه‌ی کامل: تاریخ فارسی بکمک C#
شما در حال مشاهده نسخه آرشیو هستید. برای مشاهده نسخه کامل کلیک کنید.
سلام دوستان به کمک این کد میشه به راحتی و بدونه هیچ فایل اضافه ای تاریخ میلادی را به شمسی تبدیل کرد

کد:
using System.Globalization;
PersianCalendar p = new PersianCalendar();
            string day, mon, year, wday; long s;
            day = p.GetDayOfMonth(DateTime.Now) + "";
            mon = p.GetMonth(DateTime.Now) + "";
            year = p.GetYear(DateTime.Now) + "";
            wday = p.GetDayOfWeek(DateTime.Now) + "";
            s = Convert.ToInt64(day);

            if (s < 10) day = "0" + day;
            s = Convert.ToInt64(mon);
            if (s < 10) mon = "0" + mon;
            if (wday == "Thursday")
            {
                wday = "پنج شنبه";
                
            }
            if (wday == "Friday")
            {
                wday = "آدینه";
            
            }
            if (wday == "Saturday")
            {
                wday = "شنبه";
            
            }
            if (wday == "Sunday")
            {
                wday = "یک شنبه";
                .
            }
            if (wday == "Monday")
            {
                wday = "دو شنبه";
            
            }
            if (wday == "Tuesday")
            {
                wday = "سه شنبه";
              
            }
            if (wday == "Wednesday")
            {
                wday = "چهار شنبه";
            
            }
            
            nDay = year + "/" + mon + "/" + day;

            text1.Text = "امروز=" + wday + "   مورخ   " + year + "/" + mon + "/" + day;