How to Show Islamic Date in vb.net
  • First Create a function which return date in islamic calender

    Public Shared Function ConvertDateCalendar(ByVal DateConv As DateTime, ByVal Calendar As String, ByVal DateLangCulture As String) As String

    Dim DTFormat As DateTimeFormatInfo

    DateLangCulture = DateLangCulture.ToLower()


    ' We can't have the hijri date writen in English. We will get a runtime error

    If Calendar = "Hijri" AndAlso DateLangCulture.StartsWith("en-") Then


    DateLangCulture = "ar-sa"
    End If

    ' Set the date time format to the given culture


    DTFormat = New System.Globalization.CultureInfo(DateLangCulture, False).DateTimeFormat

    ' Set the calendar property of the date time format to the given calendar


    Select Case Calendar

    Case "Hijri"
    DTFormat.Calendar = New System.Globalization.HijriCalendar()
    Exit Select
    Case "Gregorian"

    DTFormat.Calendar = New System.Globalization.GregorianCalendar()


    Exit Select
    Case Else
    Return ""

    End Select


    ' We format the date structure to whatever we want


    DTFormat.ShortDatePattern = "dd/MM/yyyy"

    Return (DateConv.[Date].ToString("f", DTFormat))


    End Function



    Where you want to call this function simply write this code

    Dim datee As String = ConvertDateCalendar(Date.Today, "Hijri", "en-US")
    MessageBox.Show(datee)


Howdy, Stranger!

It looks like you're new here. If you want to get involved, or you want to Ask a new Question, Please Login or Create a new Account by Clicking below

Login with Facebook

Popular Posts of the Week

    Optimum Creative