none
how to Set culture in ar-SA RRS feed

  • Question

  • how to set all datepicker  format in hijri  calendar 

    and i want store them sql server tables 

    i  write this code 

          Protected Overrides Function OnInitialize(ByVal commandLineArgs As System.Collections.ObjectModel.ReadOnlyCollection(Of String)) As Boolean
    
    
                ' Set the display time to 5000 milliseconds (5 seconds). 
    
                Me.MinimumSplashScreenDisplayTime = 5000
    
    
                Dim arSA As CultureInfo
                arSA = New CultureInfo("ar-SA")
                CultureInfo.DefaultThreadCurrentCulture = arSA
    
                Return MyBase.OnInitialize(commandLineArgs)
    
            End Function

    Thursday, August 22, 2019 7:29 AM

Answers

  • Hello,

    SQL-Server stores dates in the culture which it's installed on. Formatting should be done client side or you can format a date in a SELECT query as per below where you replace SYSTEMDATETIME() with your field from your table.

    FORMAT(SYSDATETIME(), 'd', 'ar-SA') => 01/03/33
    FORMAT(SYSDATETIME(), 'D', 'ar-SA') => 01/ربيع الأول/1433
    FORMAT(SYSDATETIME(), 'f', 'ar-SA') => 01/ربيع الأول/1433 02:19 ص
    FORMAT(SYSDATETIME(), 'F', 'ar-SA') => 01/ربيع الأول/1433 02:19:39 ص
    FORMAT(SYSDATETIME(), 'g', 'ar-SA') => 01/03/33 02:19 ص
    FORMAT(SYSDATETIME(), 'G', 'ar-SA') => 01/03/33 02:19:39 ص FORMAT(12345.6789, 'N', 'ar-SA') => 12,345.68
    FORMAT(12345.6789, 'C', 'ar-SA') => ر.س.‏ 12,345.68
    FORMAT(12345.6789, 'G', 'ar-SA') => 12345.6789

    See the following for the DateTimePicker (in a C# post but no code)

    https://social.msdn.microsoft.com/Forums/en-US/d59766b0-3c0c-4a3d-9a2d-bbf52818a609/datetime-picker-value-according-to-culture-info?forum=csharpgeneral


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Thursday, August 22, 2019 10:39 AM
    Moderator

All replies

  • Hi,

    I'm sorry that docs in Microsoft said that "The DateTimePicker control only supports Gregorian calendars".

    Some people have asked similar questions, you can try to see the relevant links. It's not hard to understand the C# code.

    Best Regards,

    Julie


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Thursday, August 22, 2019 9:07 AM
  • Hello,

    SQL-Server stores dates in the culture which it's installed on. Formatting should be done client side or you can format a date in a SELECT query as per below where you replace SYSTEMDATETIME() with your field from your table.

    FORMAT(SYSDATETIME(), 'd', 'ar-SA') => 01/03/33
    FORMAT(SYSDATETIME(), 'D', 'ar-SA') => 01/ربيع الأول/1433
    FORMAT(SYSDATETIME(), 'f', 'ar-SA') => 01/ربيع الأول/1433 02:19 ص
    FORMAT(SYSDATETIME(), 'F', 'ar-SA') => 01/ربيع الأول/1433 02:19:39 ص
    FORMAT(SYSDATETIME(), 'g', 'ar-SA') => 01/03/33 02:19 ص
    FORMAT(SYSDATETIME(), 'G', 'ar-SA') => 01/03/33 02:19:39 ص FORMAT(12345.6789, 'N', 'ar-SA') => 12,345.68
    FORMAT(12345.6789, 'C', 'ar-SA') => ر.س.‏ 12,345.68
    FORMAT(12345.6789, 'G', 'ar-SA') => 12345.6789

    See the following for the DateTimePicker (in a C# post but no code)

    https://social.msdn.microsoft.com/Forums/en-US/d59766b0-3c0c-4a3d-9a2d-bbf52818a609/datetime-picker-value-according-to-culture-info?forum=csharpgeneral


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Thursday, August 22, 2019 10:39 AM
    Moderator