I need help to convert Hijri Date to Gregorian. That is if i give a Date like "5/28/1435" , it should return its corresponding Gregorian date as "29 March 2014".
I tried the following code, but it gives wrong result.
Please help me..
I tried the following code, but it gives wrong result.
Code:
Public Function ConvertDateString( _
ByRef StringIn As String, _
ByRef OldCalendar As Integer, _
ByVal NewCalendar As Integer, _
ByRef NewFormat As String) As String
Dim SavedCal As Integer
Dim d As Date
Dim S As String
'// Save VBA Calendar setting to restore when finished
SavedCal = Calendar
'// Convert date to new calendar and format
Calendar = OldCalendar ' Change to StringIn calendar
d = CDate(StringIn) ' Convert from String to Date
Calendar = NewCalendar ' Change to calendar of new string
S = CStr(d) ' Convert to short format String
ConvertDateString = Format(S, NewFormat)
'// Restore VBA Calendar setting
Calendar = SavedCal
End Function
Please help me..