question

AMERSAID-7084 avatar image
0 Votes"
AMERSAID-7084 asked

Change date display with DateTimePicker

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"))
dotnet-visual-basic
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

0 Answers