We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

Gregorian Date to Hijri Date

deemas
deemas asked
on
Medium Priority
1,280 Views
Last Modified: 2007-12-19
Hi,

one of my table having a date/Time field (Gerigorian), How can i convert that in to Hijri (Arabic) Date in Form and Report Without changing the Tables' date format. My DataBase is in Access XP.

Thanks in advance
Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2006

Commented:
if your posting twice, r u gonna award twice the points?

Commented:
*********** THIS IS A DUPLICATE QUESTION ***********

Experts please don't add a comment..................

Questionner,

Please post a zero points question at:
https://www.experts-exchange.com/Community_Support/

With the link (URL-address) of this Q asking for a refund and delete !

Thanks !

Nic;o)
CERTIFIED EXPERT
Top Expert 2006

Commented:
note, this question is not being deleted

but the other question is

a recap of last post of other question (which is about to be closed)


what is the hijran date for today?

To only way is to convert it, the only way I can think of is with a function

in Forms, before you populate the field (or have another readonly field) which converts it
with regards to report, you probably need to do something similar

what did you use the validate the date conversion?

Author

Commented:
today is 09/02/1425.

I canot understand your final question. Please
CERTIFIED EXPERT
Top Expert 2006

Commented:
how are you displaying the hijri date?

in a form, you have a date, before you set that value in the textbox, you can convert it
or have a read only textbox (or caption) field which holds the equivalent hijri date - this way you see both gregorian and hijri



this code here


    Dim sDate
    Call VariantChangeTypeEx(sDate, Now(), 1025, &H8, vbString)
    MsgBox "From " & Now() & " I got " & sDate


I got from 30/03/2004 to 09/02/1425

if you put this code in a function

e.g.

public function ConvertToHijri(byval sDate as date) as string

    Dim sDate
    Call VariantChangeTypeEx(sDate, sDate, 1025, &H8, vbString)
    ConvertToHijri = sDate

end function

then in the form, call

txtDate.value = ConvertToHijri(field.GregorianDate)

Author

Commented:
Please give me some time
I am in middle of preparing important Management Report.


I will check, and come back to you.

Author

Commented:
i am getting a compile error "Duplication declaration in current scope",

By the way sdate is the date gregorian date you are refering?

Author

Commented:
i am getting a compile error "Duplication declaration in current scope",

By the way sdate is the date gregorian date you are refering?

Public Function ConvertToHijri(ByVal sDate As Date) As String
    Dim sDate
    Call VariantChangeTypeEx(sDate, sDate, 1025, &H8, vbString)
    ConvertToHijri = sDate
End Function
CERTIFIED EXPERT
Top Expert 2006
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview

Author

Commented:
Thanks a lot ,

you deserve for full Points,

Can you please explian me syntex of this fuction, and also is it possible to change the Hijri to Gregorian.

CERTIFIED EXPERT
Top Expert 2006

Commented:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/automat/htm/chap7_8h14.asp

Unfortunately I do not know all the parameters for the different flags

I think the gregorian is &H40

so if you pass in a hijri date, and put &H40 instead of &H8, see what you get

(maybe create another function, same type of thing except called ConvertToGregorian)



Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.