472,333 Members | 1,140 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,333 software developers and data experts.

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 15827

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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: nimish | last post by:
I have Month, Day and Year fields on my form. When I submit this form I want to create a valid date from all three fields before inserting into...
9
by: Se'noj | last post by:
Hi all, In a program I am writing, I need to convert a date stored as an integer number of days into a standard gregorian format, with day zero...
3
by: Chris Davoli | last post by:
Is there a class that converts from Gregorian date to TRUE Julian Date in ..NET? Any VB.NET examples available? ie; The Julian date is...
1
by: Franck | last post by:
Hi, 'm gettin mad about date conversion. Here is the point. Got and add-in for Excel which call functions from a web service (on a remote...
1
by: vadala | last post by:
The requirement is to send start data and end date from java to UI (.net) for a functionality. We are setting the time in java (1.5) before...
7
by: bruce.dodds | last post by:
Access seems to be handling a date string conversion inconsistently in an append query. The query converts a YYYYMM string into a date, using the...
2
by: RN1 | last post by:
A TextBox displays the current date (in dd/mm/yyyy format) & time when a user comes to a page (e.g. 15/10/2008 1:36:39 PM). To convert the date...
2
by: anderst | last post by:
Hi! I need help with date conversion, I need a perl-script that transform Wed Mar 28 00:00:00 GMT+02:00 2007 to 2007-03-28 I have tried to...
4
maheshwag
by: maheshwag | last post by:
my code is: string sql="insert into dummy(date)values(@date) sqlcommand cmd=new sqlcommand(sql,con) cmd.parameters.Add("@date",...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.