By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,084 Members | 1,510 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,084 IT Pros & Developers. It's quick & easy.

Date Conversion Hijri to Gregorian

P: n/a
Dear Respected Gurus,

I need a coding assistant converting from gregorian to hijri and vice
versa. I have problem with this codes. the problem Gregorian to Hijri
gives 100% results. when i enter this to Hijri to gregorian it either
do nothing or go to next record on form. well there r two fields on
form that r calc afterevents each other dates.

ur assistance will be highly appreciated, if any one can tell what is
wrong with this codes

Function strHijri(dtGregorian As Date) As String
' returns a date in Hijri format for a given western date
VBA.Calendar = vbCalHijri
strHijri = Day(dtGregorian) & "/" _
& Month(dtGregorian) & "/" _
& Year(dtGregorian)
VBA.Calendar = vbCalGreg
End Function

Function strGregorian(dtHijri As String) As String
' returns a date in Hijri format for a given western date
VBA.Calendar = vbCalGreg
strGregorian = Day(dtHijri) & "/" _
& Month(dtHijri) & "/" _
& Year(dtHijri)
VBA.Calendar = vbCalHijri

End Function

Nov 13 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a

SalimShahzad wrote:
Dear Respected Gurus,

I need a coding assistant converting from gregorian to hijri and vice
versa. I have problem with this codes. the problem Gregorian to Hijri
gives 100% results. when i enter this to Hijri to gregorian it either
do nothing or go to next record on form. well there r two fields on
form that r calc afterevents each other dates.

ur assistance will be highly appreciated, if any one can tell what is
wrong with this codes

Function strHijri(dtGregorian As Date) As String
' returns a date in Hijri format for a given western date
VBA.Calendar = vbCalHijri
strHijri = Day(dtGregorian) & "/" _
& Month(dtGregorian) & "/" _
& Year(dtGregorian)
VBA.Calendar = vbCalGreg
End Function

Function strGregorian(dtHijri As String) As String
' returns a date in Hijri format for a given western date
VBA.Calendar = vbCalGreg
strGregorian = Day(dtHijri) & "/" _
& Month(dtHijri) & "/" _
& Year(dtHijri)
VBA.Calendar = vbCalHijri

End Function


Did you check MichKa's site? www.trigeminal.com? He's the resident
internationalization guru...

Nov 13 '05 #2

P: n/a
<pi********@hotmail.com> wrote in message
news:11*********************@c13g2000cwb.googlegro ups.com...

SalimShahzad wrote:
Dear Respected Gurus,

I need a coding assistant converting from gregorian to hijri and vice
versa. I have problem with this codes. the problem Gregorian to Hijri
gives 100% results. when i enter this to Hijri to gregorian it either
do nothing or go to next record on form. well there r two fields on
form that r calc afterevents each other dates.

ur assistance will be highly appreciated, if any one can tell what is
wrong with this codes

Function strHijri(dtGregorian As Date) As String
' returns a date in Hijri format for a given western date
VBA.Calendar = vbCalHijri
strHijri = Day(dtGregorian) & "/" _
& Month(dtGregorian) & "/" _
& Year(dtGregorian)
VBA.Calendar = vbCalGreg
End Function

Function strGregorian(dtHijri As String) As String
' returns a date in Hijri format for a given western date
VBA.Calendar = vbCalGreg
strGregorian = Day(dtHijri) & "/" _
& Month(dtHijri) & "/" _
& Year(dtHijri)
VBA.Calendar = vbCalHijri

End Function


Did you check MichKa's site? www.trigeminal.com? He's the resident
internationalization guru...


He's got code to convert back and forth between Hijri and Gregorian at
http://www.trigeminal.com/codes.asp?ItemID=14#14

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(No private e-mails, please)

Nov 13 '05 #3

P: n/a
See?!! I knew it was there! Makes me think I'd be better as a
librarian than a programmer!

Nov 13 '05 #4

P: n/a
Dear Gurus,

There is problem in passing date as string, can any one send reference
of codes will help a bit for me. as in text box, table field has set as
date.

when i call as msgbox under "1/1/2005" or "1/1/1426" it gives 100%
results, but when i used via text box value putting it gives unexpected
dates or results

i had try following

MsgBox StDteHijriOfStDteGreg("'" & Dt_Dob_en.Value & "'")
MsgBox StDteHijriOfStDteGreg( Dt_Dob_en.Value)
MsgBox StDteHijriOfStDteGreg(cstr(Dt_Dob_en.Value))

even i define as string variable and pass value to this and then try
but the results is same...

can any one help me how to pass date as string to function in modules
thanks and rgds
shahzad

Nov 13 '05 #5

P: n/a

SalimShahzad wrote:
Dear Gurus,

There is problem in passing date as string, can any one send reference of codes will help a bit for me. as in text box, table field has set as date.

when i call as msgbox under "1/1/2005" or "1/1/1426" it gives 100%
results, but when i used via text box value putting it gives unexpected dates or results

i had try following

MsgBox StDteHijriOfStDteGreg("'" & Dt_Dob_en.Value & "'")
MsgBox StDteHijriOfStDteGreg( Dt_Dob_en.Value)
MsgBox StDteHijriOfStDteGreg(cstr(Dt_Dob_en.Value))

even i define as string variable and pass value to this and then try
but the results is same...

can any one help me how to pass date as string to function in modules
thanks and rgds
shahzad

You REALLY need to make friends with the helpfile. REALLY. How about
using something like oh, I dunno... CDATE() or DATESERIAL or one of
those other handy dandy conversion/date functions. Or shock of shocks,
pass the stupid thing as a DATE, not a text string.

Nov 13 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.