Option Explicit
Function TbH(Jdate As String, Optional mode As Integer)
On Error GoTo ErrorHandler
    
Dim txtYear, txtMonth, txtDay, S As String
Dim StandardDate, StandardYear, StandardMonth, StandardDay As String
Dim DayofWeek As String
Dim x20 As New DateClass
    x20.Initial
 
 If Left(Jdate, 2) = "13" Then StandardDate = x20.NormDate(Jdate) Else StandardDate = x20.NormDate(13 & Jdate)
 
StandardYear = Left(StandardDate, 4)
StandardMonth = Mid(StandardDate, 5, 2)
StandardDay = Right(StandardDate, 2)
Select Case Val(StandardMonth)
    Case 1
       S = " فروردين "
    Case 2
       S = " ارديبهشت "
    Case 3
       S = " خرداد "
    Case 4
       S = " تير "
    Case 5
       S = " مرداد "
    Case 6
       S = " شهريور "
    Case 7
       S = " مهر "
    Case 8
       S = " آبان "
    Case 9
       S = " آذر "
    Case 10
       S = " دي "
    Case 11
       S = " بهمن "
    Case 12
       S = " اسفند "
End Select
txtYear = Horof(Val(StandardYear))
txtMonth = S
txtDay = Horof(Val(StandardDay))
DayofWeek = J_WEEKDAY(Jdate, 1)
 Select Case mode
    Case 0
            TbH = Val(StandardDay) & txtMonth & StandardYear
    Case 1
            TbH = txtDay & txtMonth & txtYear
    Case 2
            TbH = DayofWeek & "، " & txtDay & txtMonth & txtYear
End Select
Exit Function
ErrorHandler:
TbH = "#Error"
End Function

ورود به سایت