469,289 Members | 2,341 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,289 developers. It's quick & easy.

Date Conversion Hijri to Gregorian

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
5 15508

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
<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
See?!! I knew it was there! Makes me think I'd be better as a
librarian than a programmer!

Nov 13 '05 #4
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

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.

Similar topics

8 posts views Thread by nimish | last post: by
9 posts views Thread by Se'noj | last post: by
3 posts views Thread by Chris Davoli | last post: by
1 post views Thread by Franck | last post: by
2 posts views Thread by RN1 | last post: by
2 posts views Thread by anderst | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.