Click here to Skip to main content
15,843,031 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Thank you for resolving errors from programmers here.

I want to display the Hijri date with the Gregorian date in the label.

What I have tried:

Private Sub Page_Load(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
        If Page.IsPostBack = False Then
            Textbox1.Text = Request.QueryString("prompt0")
            RDate = CDate(Request.QueryString("prompt1"))
            CCDate = CDate(Request.QueryString("prompt2"))
            d3 = Request.QueryString("prompt3")
            d4 = Request.QueryString("prompt4")
            '  d5 = 1

        End If

    End Sub
Updated 3-Nov-23 4:17am

1 solution

Check this out: Is it possible to convert Gregorian to Hijri date in Vb?[^]

Dim d As DateTime = DateTime.Today

Dim gc As GregorianCalendar = New GregorianCalendar()
Dim hc As HijriCalendar = New HijriCalendar()

Dim dg = New DateTime(d.Year, d.Month, d.Day, gc)
Dim dh = New DateTime(d.Year, d.Month, d.Day, hc)

Console.WriteLine($"Gregorian date: {dg.ToString("dd MMMM yyyy")} => Hijri date: {dh.ToString("dd MMMM yyyy")}")

More at:
HijriCalendar Class (System.Globalization) | Microsoft Learn[^]
DateTime Constructor (System) | Microsoft Learn[^]
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900