473,396 Members | 1,895 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 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 16054

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 MYSQL table. I tried following:...
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 being 1/1/1800. Can anyone help me with this? ...
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 calculated by the number of days since January 1, 4713 BC....
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 server) The remote server has regional settings set...
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 handing it over to WebService (sending to UI ) in...
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 following function: CDate(Right(,2) & "/1/" &...
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 into international format so that the remote server...
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 use perl modules Date::Manip and Date::Calc, but no...
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", SqlDbtype.datetime).values=maskedtextbox1.text;...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.