none
Date Format Question (reverts to US date format)

    Question

  • I live in the United Kingdon and use dates in the short date format dd/mm/yyyy. I have an application that works perfectly with Windows XP and Windows Vista when you change the date format on a machine in the "Regional and Language Options" of the "Control Panel" the dates display properly in the application.

    The application was developed with Delphi 2009, I believe, in case this makes any difference.

    When run under Windows 7 all the date fields show up in US format (mm/dd/yyyy) even though all the regional settings, etc. have been set correctly on the machine. Furthermore, running the application in either the Windows XP or Windows Vista emulations does not cure the problem.

    Is there a known issue about this in Windows 7 or/and does anyone have any ideas?

    Thank you
    Thursday, December 3, 2009 7:10 AM

Answers

  • Hi,

     

    Thank you for your update.

     

    Considering the issue is related to application developing, it is still recommended that you contact Delphi support or our MSDN forum for further investigation. This should be more efficient.

     

    Thanks again.


    Nicholas Li - MSFT
    Monday, December 7, 2009 9:34 AM
    Moderator

All replies

  • Hi,

     

    Please try to run the application with Compatibility Mode and see how it works.

     

    Since this is an application developing related question, it is recommended that you try the following methods for further investigation:

     

    Delphi support:

     

    Windows 7 Development Center

     

    MSDN forum:

     

    Software Development for Windows Client

     

    Thanks.


    Nicholas Li - MSFT
    Friday, December 4, 2009 11:03 AM
    Moderator
  • Hi Nicholas,

    Thank you for your answer.

    Running the application in Compatibility Mode makes no difference.

    However, if the application is left running for a number of hours then by moving between other applications the date format changes to the correct format. If the application is re-started the date format reverst to the US date format.

    This sure sounds like a Windows 7 bug to me.

    Thanks
    Saturday, December 5, 2009 12:05 PM
  • Hi,

     

    Thank you for your update.

     

    Considering the issue is related to application developing, it is still recommended that you contact Delphi support or our MSDN forum for further investigation. This should be more efficient.

     

    Thanks again.


    Nicholas Li - MSFT
    Monday, December 7, 2009 9:34 AM
    Moderator
  • Hi,

    I am also having the exact same issue, but with 2 other LOB applications that we use.  It's definitely correct in Regional Settings but the application fails to recognise it.  One workaround I have is to change the Format under Region and Language to another language e.g. English (Canada) and then change it back again to what it should be, in my case English (Australia) and that seems to fix my issue.

    This workaround isn't feasible for a couple of hundred machines that will eventually be migrated to Windows 7.

    Infrazee, let me know if that fixes your date issue with Delphi 2009?

    Cheers
    • Proposed as answer by SuperflyAU Monday, January 18, 2010 10:00 AM
    Monday, December 21, 2009 12:16 AM
  • Hi,

    I am also having the exact same issue, but with 2 other LOB applications that we use.  It's definitely correct in Regional Settings but the application fails to recognise it.  One workaround I have is to change the Format under Region and Language to another language e.g. English (Canada) and then change it back again to what it should be, in my case English (Australia) and that seems to fix my issue.

    This workaround isn't feasible for a couple of hundred machines that will eventually be migrated to Windows 7.

    Infrazee, let me know if that fixes your date issue with Delphi 2009?

    Cheers
    Thanks George, worked for me as well. Good to see (not) Microsoft denying this bug, some things never change. Spent a whole weekend trying to fix problem.
    Monday, January 18, 2010 10:03 AM
  • Hi
    Have you managed to fix the problem as I am having the same issue. 
    Thanks

    Russell

    Newcastle-upon-tyne
    Sunday, February 14, 2010 9:43 PM
  • This is a Windows 7 Bug.

    We have the same issue with Delphi Applications on Windows 7 with a New Zealand locale.

    I have done some investigation around how Delphi retrieves it's Short Date Format from the Windows OS, and it is clear that Windows 7 is not storing/saving the format correctly until you select the regional settings a second time in Windows Regional Settings and save.

    The issue can be easily replicated by creating an application that calls the Windows API function directly (note there are no Delphi specific functions here, only API calls):

    GetLocaleInfo(DefaultLCID, LOCALE_SSHORTDATE, Buffer, 255);

    Where

    Buffer is a null terminated string 255 in length
    LOCALE_SSHORTDATE = $0000001F
    DefaultLCID = GetThreadLocale()

    This will return 'mm/dd/yyyy' into Buffer, unless you have reselected New Zealand in the Windows Regional settings and saved for a second time.

    I have not investigated as to when the oringal setting (that didn't save correctly) was set, i.e during upgrade? or during new install or after install.

    Tim
    Tuesday, February 16, 2010 9:20 PM
  • If you open "Regional and Language Options" from the control panel (the globe icon) / intl.cpl, and reselect your locale it will likely solve the problem. 

    1) Open Regional and Language Options
    2) Under "Format" pick anything else. (eg: English (United States)).
    3) Press "Apply"
    4) Under "Format" pick your desired locale (eg: English (United Kingdom)).
    5) Press OK.

    FWIW: Windows stores duplicate locale "name"s and "LCID"s (it's best if you use the named APIs, eg: GetLocaleInfoEx()), and they got out-of-sync when windows was installed.  Rerunning intl.cpl gets them back in-sync.

    -Shawn
    Thursday, March 18, 2010 4:31 PM
  • This work around does work as I also mentioned in my post, it's going to have to go out as an announcement to all of our clients in case they upgrade to Windows 7.

    It happens on every install of Windows 7, and also happens if you have already selected the region again and then when you create a new user and log on as that user - they must reselect the region again to get the correct result.

    I've logged this bug with Microsoft via Microsoft Premier, just be interesting if we get a fix for those outside of the US.

    :-)


    Tim
    Friday, March 19, 2010 12:30 AM
  • Hey TBurrows,

    Your fix has saved the day for our NZ clients rolling out new Win7 servers.

    Our application was showing the wrong format and we could not work out why?

    Your fix is nice and easy but should be fixed by MS.

    Cheers

    Rob

     

     

     

     

    Tuesday, April 27, 2010 12:15 AM
  • I have a similar issue.

    In Excel 2007 and MS-Money 2005, fields that previously displayed dd-mmm-yy data formats now shows as d-mm-yy or dd-mm-yy

    (02-Jun-10 now displays 02-06-10 or 2-06-10)

    I've checked all Language and Region settings, changed them to English(Canada) and then reset them back to English(Australia), but that did not work. I have 100's of spreadsheets that I use professionally (as well as for my customers). 

    In Excel, I can manually change the format back to dd-mmm-yy, but it would take days to change it on all spreadsheets.

    Cheers, P-F

    Thursday, June 3, 2010 2:32 AM
  • Have similar issue with Regional Options:

    One of our apps displays Euros instead of Dollars.  Reason:

    -French version of Win7 out of box(France locale)

    -They change to French Canada

    -The old locale seems to stay

    -Have to manually re-apply French-canada locale (as per Shawn's workaround)

    We have hundreds of clients and have to manually re-apply oursleves...been doing it for months...I guess 'Windows 7 was(n't) my idea' after all....

    All puns aside I do hope there's going to be a patch soon.

    Thursday, June 24, 2010 5:50 PM
  • Hi Tim

    I just had the same issu as you (also doing Delphi development).

    If you wish to avoid your users to do the workaround themselves, use the following unit as the first in your project:

    unit Win7;
    
    interface
    
    uses
     SysUtils, Windows;
    
    implementation
    
    initialization
     SetThreadLocale(LOCALE_USER_DEFAULT);
     GetFormatSettings;
    end.
    

    HTH

    Søren

    Friday, September 3, 2010 8:29 AM
  • Hi there, i had exactly the same issue. It was changing my £ to $ and my date was in the wrong format.


    I have managed to change it by simply changing to english (US) and back to english (uk)

    Thank you so much! I have been struggling with this for 2 months!

     

     

    Thursday, January 13, 2011 12:23 PM
  • Hi All,

    I'm also experiencing the same problem with the decimal separator.  I have an older delphi 5 application and some users reported errors when running in windows 7 environment. From my custom error logs I can see the issue is with converting a strToFloat and that the decimal separator is not being returned correctly.

    I have tried various windows 7 editions, professional/Home/Enterprise, 32 bit and 64 bit but to date I have not been able to replicate the error. 

    Has anyone been able to determine the specific conditions that this will occur?

    So far this suggested work around appears to be working for my users, I would like to look at using the additional code lines suggested but unless I can replicate the error I can't confirm if the extra lines are of any benefit. 

    Has this been recognised as an official bug by Microsoft?

    Thanks in advance for any info

    KD

     

    • Proposed as answer by Kusumura Sunday, April 3, 2011 9:52 PM
    • Unproposed as answer by Kusumura Sunday, April 3, 2011 9:52 PM
    Thursday, February 17, 2011 8:43 AM
  • Hi

    First, thank you very much George. I tried to change only specific formats, but no the all language selection. Good tip. Thanks again.

    Second, Two years and it is happening yet. I fear It will be necessary until the day Windows 7 dies. Bad luck :-(

    Best regards

    Monday, December 12, 2011 12:58 PM
  • I'm a Delphi developer and had an old application in Delphi 7 show the date problem. I'm in the UK and if I was to use GetLocaleFormatSettings it would show short date format in MM/dd/yyyy and currency in $. I did a fix in my application but unfortunately the third party (devexpress) date component was still displaying the US format. The SetThreadLocale tip above did not seem to work, the date component would show dd/mm/yyyy but the validation was still checking for mm/dd/yyyy so it wouldn't accept when the day > 12.

    The problem seemed to be fixed after I viewed the the registry HKEY_CURRENT_USER/Control Panel/International/Locale. It originally stated 409 which is US (it should of been 809) even though my Region and Language Format was English (United Kingdom). I then changed my Format to English (Zimbabwe) and applied it, then changed back to English (United Kingdom) and applied it. Refreshing the registry showed that it was correctly set as 809. After a few reboots it has stayed correctly set and it means I do not have to make any modifications to my old application.

    Delphi aside, that sounds like a Windows 7 bug to me! 

    Tested on Windows 7 SP1 64 bit.

    Tuesday, January 10, 2012 9:32 AM
  • Thank you so much Shawn - your answer is absolutely correct. My guess is that the Regional and Language settings were set by by-passing the normal mode of setting and not all values were correctly set up. I must re-iterate to others that it is IMPORTANT to actually SAVE (apply and OK) an alternate value (ie. English (Phillipines) ) BEFORE saving the correct one. Not to just 'fool' the system into thinking it has been save by selecting a new one then immediately selecting the correct one.

    Microsoft needs to put this on a "Top 10 Microsoft troubleshooting time waster issues" list to the company's doing their install and support - the MS support company here had no idea what the problem was and as always put it back on the software developers - us.

    • Proposed as answer by Freqy Monday, February 27, 2012 12:50 AM
    Tuesday, February 7, 2012 9:53 PM
  • Hi All

    I just stumbled over this discussion and wish to add a detail:

    If the app ignores the control panel date format it can - true -  be solved by editing the:

    HKEY_CURRENT_USER\Control Panel\International\Locale value.

    However, it is also a good idea to change the default user value in order to future users to be created without the discussed error:

    HKEY_ USERS\DEFAULT\Control Panel\International\Locale

    You may also wish to edit the LocaleName entry below the Locale entry etc.

    NOTE: Have more users’ already been created, thesemust either be deleted and re-created orthey must all be edited as
    in
    HKEY_CURRENT_USER – ask your Helpdesk for assistance J

    NOTE: Reboot required.





    Tuesday, March 27, 2012 11:06 AM