سلام من این فانکشن را درست کردم برای این که تعدادی ماه به تاریخ فارسی اضافه کنیم و تاریخ جدید فارسی را بگیریم جواب نمی ده
ولی این ساب جواب میده همون کد هستش:
کد PHP:
Function J_addmonth(Jdate1 As String, addmonth As Integer)
Dim mah As Integer
Dim rooz As Integer
Dim sal As Integer
rooz = Right(Jdate1, 2)
mah = (Right(Left(Jdate1, 7), 2) + addmonth)
If mah Mod 12 = 0 Then
sal = Left(Jdate1, 4) + (Int(mah / 12)) - 1
Else
sal = Left(Jdate1, 4) + (Int(mah / 12))
'ÊÇ ÇíäÌÇ ÓÇá ÈÏÓÊ ãí ÇíÏ
End If
If mah Mod 12 = 0 Then
mah = 12
Else
mah = mah Mod 12
End If
If rooz = 31 And (mah Mod 12 = 0) Then
rooz = rooz - 1
ElseIf rooz = 31 And (mah Mod 12 > 6) Then
rooz = rooz
End If
If mah < 9 And rooz > 9 Then
J_addmonth = (sal) & "/0" & (mah) & "/" & (rooz)
ElseIf mah < 9 And rooz < 9 Then
J_addmonth = (sal) & "/0" & (mah) & "/0" & (rooz)
ElseIf mah > 9 And rooz < 9 Then
J_addmonth = (sal) & "/" & (mah) & "/0" & (rooz)
Else
J_addmonth = (sal) & "/" & (mah) & "/" & (rooz)
End If
End Function
کد PHP:
Sub fff()
Dim Jdate1 As String, mah1 As Integer
Jdate1 = "1392/05/31"
addmonth = 8
mah = (Right(Left(Jdate1, 7), 2) + addmonth)
rooz = Right(Jdate1, 2)
sal1 = Left(Jdate1, 4)
MsgBox sal1
If mah Mod 12 = 0 Then
sal = Left(Jdate1, 4) + (Int(mah / 12)) - 1
Else
sal = Left(Jdate1, 4) + (Int(mah / 12))
'ÊÇ ÇíäÌÇ ÓÇá ÈÏÓÊ ãí ÇíÏ
End If
If mah Mod 12 = 0 Then
mah = 12
Else
mah = mah Mod 12
End If
If rooz = 31 And (mah Mod 12 = 0) Then
rooz = rooz - 1
ElseIf rooz = 31 And (mah Mod 12 > 6) Then
rooz = rooz
End If
If mah < 9 And rooz > 9 Then
jaddmonth = (sal) & "/0" & (mah) & "/" & (rooz)
ElseIf mah < 9 And rooz < 9 Then
jaddmonth = (sal) & "/0" & (mah) & "/0" & (rooz)
ElseIf mah > 9 And rooz < 9 Then
jaddmonth = (sal) & "/" & (mah) & "/0" & (rooz)
Else
jaddmonth = (sal) & "/" & (mah) & "/" & (rooz)
End If
MsgBox jaddmonth
End Sub
کامنت