hi
Welcome
The following tool DateTimePicker takes the Date of the device.
I want if the date of the device is Hijri, the date will be shown in the tool DateTimePicker with the Gregorian date.
I have tried all of the following methods to bypass the device date and ignore it if it is not AD. There is no result.
'//1
Dim Ar As CultureInfo = New CultureInfo("ar-eg") '
Thread.CurrentThread.CurrentCulture = Ar
Ar.DateTimeFormat.Calendar = New GregorianCalendar
'/// 2
Dim ci As CultureInfo = New CultureInfo("ar-eg")
Dim info As DateTimeFormatInfo = ci.DateTimeFormat
DateTimePicker1.Format = System.Windows.Forms.DateTimePickerFormat.Custom
DateTimePicker1.CustomFormat = info.ShortDatePattern
'/// 3
Function Tomiladeg(ByVal gDate As Date, Optional ByVal format As String = Nothing) As String
Return gDate.ToString(format, New Globalization.CultureInfo("ar-EG"))
End Function
DateTimePicker1.Value = Convert.ToDateTime(Tomiladeg(Now, "dd-MM-yyyy"))