none
datetime format issue for Philippines and Canada in Windows RRS feed

  • Question

  • Hello Team,

    We have a requirement to select different date formats for English(Philippines) in Windows OS -> Region Date time format, but we see only the 2 options from Shortdate and the default selection is dd/MM/yyyy there. We have tried to modify the short date by clicking on Additional settings to M/dd/yyyy and saved , but the issue is when we again open the Region and selects English(United States) and saves and then again selects back the English(Philippines) , the format which we have saved for English(Philippines) as default is not there it is reverted back to original as dd/MM/yyyy. Is there any way we can add more custom date formats for English(Philippines) and English(Canada) and select as default.

    This is required as when we change culture in our .Net application to en-PH, the date is showing as dd/MM/yyyy format. But, the requirement is for en-PH , the date format should be M/dd/yyyy. 

    This is very critical for us, please help us in providing some solutions.

    Thanks & Regards,

    Ajit Kumar Subudhi,


    Monday, March 19, 2018 3:42 AM

All replies

  • What you see is a presentation. The DateTime itself is a struct (Int64) which contains as value a tick from 100th nanoseconds which start at 1/1/1 0:0:0  counting. It has endless properties and methods to show that tick in many representations, including the culture which is in use or is set. 

    Success
    Cor

    Monday, March 19, 2018 4:43 AM
  • Have you created many threads about the same issue?
    If so, that is annoying, please do not repeat that.  

    Ashidacchi >> http://hokusosha.com/

    Monday, March 19, 2018 5:37 AM
  • Hello,

    According to your description, I am not sure what problem you are experiencing is. Do you have some issue about datetime format in your vb.net project? Please describle more detail info about your issue

    Best Regards,

    Cherry


    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.

    Monday, March 19, 2018 6:49 AM
    Moderator
  • Hi Cherry,

    Thanks for your reply , the issue is described below :

    In .Net we write code as :

     CultureInfo cul = new CultureInfo("en-PH");
     Console.Write(dt.ToString("",cul));

    The date format it returns for Shortdate is dd/MM/yyyy which it is referring from Windows Region datetime format setting which is currently dd/MM/yyyy . So there is no issue in .Net code.

    The requirement is for en-PH culture the shortdate  format should be displayed as M/dd/yyyy

    So, the question is : Is there any way we can set the datetime format in Windows Region for English(Philippines)  as M/dd/yyyy , so that the .Net application will return the shortdatetime format M/dd/yyyy

    Thanks & Regards,

    Ajit

    Monday, March 19, 2018 7:10 AM
  • Have you any documentation which tells that the date in En-ph is M/dd/yyyy. According to Wikepedia this is not

    used https://en.wikipedia.org/wiki/Date_and_time_notation_in_the_Philippines

    Sadly enough you only replied to Cherry, therefore I don't know if you really understand the datetime. 

    But one of the properties to set it so any format you want is the parseexact

    https://msdn.microsoft.com/en-us/library/system.datetime.parseexact(v=vs.110).aspx


    Success
    Cor

    Monday, March 19, 2018 8:58 AM
  • Hi Cor,

    Thanks a lot for your multiple responses on my query.

    The code is already written in multple places in the application when the user changes the application culture to English(Philippines) , the same code returns date in M/dd/yyyy in lower environments. But, same code is returning date format in dd/MM/yyyy in different environment. And while comparing it is observed that the date format which we see is as per the Region settings in the system.

    In one Windows OS the short datetime format is M/dd/yyyy for English(Philippines) and in other it is dd/MM/yyyy.

    And while testing we see different date formats for different environments for English (Philippines) in the Application UI when the user changes the Application culture to English (Philippines).

    So, I thought there could be some way the system Region dateformat can be set.

    Thanks & Regards,

    Ajit

    Monday, March 19, 2018 9:13 AM
  • That you did not write before. But as it is as you write, then on those systems the date time is probably set as you don't want it.

    You can change those settings only for your program

    https://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.datetimeformat(v=vs.110).aspx


    Success
    Cor


    Monday, March 19, 2018 9:25 AM
  • The code is already written in multple places in the application ...

    You'll need to modify the code.

    Create a new instance of the CultureInfo, modify the DateTimeFormat property as needed then use that instance of CultureInfo throughout the program.  You can follow the example in the documentation Cor linked.


    Reed Kimble - "When you do things right, people won't be sure you've done anything at all"

    Monday, March 19, 2018 11:35 AM
    Moderator