Resources » Code Snippets » Active Directory

English date convert to Arabic Date


Posted Date: 14-Jan-2008  Last Updated:   Category: Active Directory    
Author: Member Level: Silver    Points: 10



Shows how to convert English date to arabic date

Put a Date TimePicket and a Text box object in the from which name dtpFrom and txtarDate. Change any date from the dtpFrom its automatic change the Arabic in the txtArDate text box.

Private Sub dtpFrom_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dtpFrom.ValueChanged
Me.txtArDate.Text = HDate(Me.dtpFrom.Value) & " H"
End Sub

Here Hdate function Caculate Arabic date. This fuction put in the Module.

Public Function HDate(ByVal DateEntry As Date)
Dim xx As Date
Dim adj_days, x, d, M, xdate1, xdate2, xdate3, Arabicdate
xx = "02/15/1592"
adj_days = -Year(DateEntry) + 2000
x = DateDiff("d", xx, DateEntry) + adj_days
d = Int(((x / 29.5) - Int(x / 29.5)) * 29.5)
M = Int((((x / 354) - Int(x / 354)) * 354) / 29.5)
xdate1 = Right(Str(100 + d + IIf(d = 0, 30, 0)), 2)
xdate2 = Right(Str(100 + M + IIf(M = 0, 12, 0) - IIf(d = 0, 1, 0)), 2)
xdate3 = Str(1000 + Int(x / 354) - IIf(M = 0, 1, 0))
Arabicdate = xdate1 + "/" + xdate2 + "/" + Trim(xdate3)
HDate = Arabicdate
End Function


Did you like this resource? Share it with your friends and show your love!

Responses to "English date convert to Arabic Date"
Guest Author: Haider     14 May 2012
Thank you very much this is an excellent code, I would be very happy if you make one that converts from Arabic to English Date


Feedbacks      

Post Comment:




  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:   Sign In to fill automatically.
    Email: (Will not be published, but required to validate comment)



    Type the numbers and letters shown on the left.


    Submit Article     Return to Article Index

    Subscribe to Subscribers
    Active Members
    TodayLast 7 Daysmore...

    Awards & Gifts
    Talk to Webmaster Tony John

    Online Members

    Akshay P
    More...
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India