سلاممیخواستم بدونم کسی تقویم فارسی درست وحسابی برای استفاده تو سی شارپ سراغ داره؟ممنونم.
Printable View
سلاممیخواستم بدونم کسی تقویم فارسی درست وحسابی برای استفاده تو سی شارپ سراغ داره؟ممنونم.
اگر از datapiker استفاده كني و dll اضافه كني تقويم فارسي ميشه و شمسي
من این کد رو به زبون VB.net داشتم. با این کد میتونی تقویم شمسی داشته باشی.
کد:
Imports System.Globalization
Module Hijri_Shamsi
Public Function Shamsi_Date(ByVal DT As Date, ByVal IntMod As Integer) As String
Dim Glob As New PersianCalendar
Dim StrMonth As String, StrDay As String
Static DayCollection() As String = New String() {"يكشنبه", "دوشنبه", "سه شنبه", "چهارشنبه", "پنجشنبه", "جمعه", "شنبه"}
Static MonthCollection() As String = New String() {"فروردین", "اردیبهشت", "خرداد", "تیر", "مرداد", "شهریور", "مهر", "آبان", "آذر", "دی", "بهمن", "اسفند"}
Dim StrDayName As String = Nothing
Dim StrMonthName As String = Nothing
Shamsi_Date = Nothing
StrMonth = Glob.GetMonth(DT)
StrDay = Glob.GetDayOfMonth(DT)
StrMonthName = MonthCollection(Val(StrMonth) - 1)
StrDayName = DayCollection(Val(Glob.GetDayOfWeek(DT)))
If StrMonth.Length = 1 Then StrMonth = "0" & StrMonth
If StrDay.Length = 1 Then StrDay = "0" & StrDay
Select Case IntMod
Case 1
Return Glob.GetYear(DT) & "/" & StrMonth & "/" & StrDay
Case 2
Return Glob.GetYear(DT) & "/" & StrMonth & "/" & StrDay & " " & StrDayName
Case 3
Return StrDayName & " " & StrDay & " " & StrMonthName & " " & Glob.GetYear(DT)
Case 4
Return Glob.GetYear(DT) & StrMonth & StrDay
End Select
End Function
End Module
سلام
اگر منظور کنترلری با UI است میتوانید نمونه زیر را امتحانی کنید:
کد:http://support.h02.ir/fwlink/?LinkId=1002976157