question

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

format the time in DateTimePicker

I want to format the time DateTimePicker to 24 hours.

I used the following code and the time is actually changed to 24 hours. The problem now is that the date format takes an undesirable shape when using an Arabic region for the device or an English region. I want the direction of the date to not change no matter how different the region of the device.

I want the direction of the date to be an hour and a minute and am pm as in the picture, regardless of the time zone

120593-untitled2.png


  If Thread.CurrentThread.CurrentCulture.DisplayName.Contains("arab".ToLower)  Then
                     ROSYUPDATE_F.DateTimePicker.Format = System.Windows.Forms.DateTimePickerFormat.Custom
                     ROSYUPDATE_F.DateTimePicker.CustomFormat = "HH:mm tt" 
                 Else
        
                     ROSYUPDATE_F.DateTimePicker.Format = System.Windows.Forms.DateTimePickerFormat.Custom
                     ROSYUPDATE_F.DateTimePicker.CustomFormat = " tt mm:HH"
                 End If


Animation that changes the time from the desired format

120582-untitled.gif


dotnet-visual-basic
untitled2.png (7.4 KiB)
untitled.gif (1.8 MiB)
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