Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21159

Help Needed - Hijri to Gregorian Date convertion

$
0
0
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.

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..

Viewing all articles
Browse latest Browse all 21159

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>