SubMain - CodeIt.Right The First Time!

/Community

A Support Community for SubMain Products
 Home Products Services Download Purchase Support
in Search
 
Home Forums Blogs Tutorials Downloads
Welcome to SubMain Community Sign in | Join | Help

Date format in environment macros

Last post 12-15-2009, 12:41 AM by Misha Zhutov. 5 replies.
Sort Posts: Previous Next
  •  12-10-2009, 4:58 PM 1023

    Date format in environment macros

    Hello,

    I'm trying to use the environment macro $(Environment.Date) but it keeps inserting the date in US format. My system has been set to English (Australian).

    Any ideas on how to fix this?

    Thanks in advance,

     Alex.

    Filed under:
  •  12-11-2009, 3:21 AM 1024 in reply to 1023

    Re: Date format in environment macros

    Hello,

    The macro $(Environment.Date) generates code DateTime.Now.ToString("d").

    So, it should output date in format that set up in Control Panel -> Regional And Language Options -> Date -> Short Date Format.

     


    Thank you,
    Misha Zhutov
    http://submain.com - .NET Developer Tools | Microsoft VB MVP
  •  12-13-2009, 10:24 PM 1028 in reply to 1024

    Re: Date format in environment macros

    Hi and thanks for your reply. There must be more going on here because I've done another test and this definitely isn't working. See the following screenshot:

     

    I missed including in the screenshot that GhostDoc creates a date of 12/14/2009 here. As mentioned before, everything is set to English (Australian).

  •  12-14-2009, 4:45 AM 1031 in reply to 1028

    Re: Date format in environment macros

    It is really weird... I tested that on clean machine and everything worked well.

    I can only guess that you have another add-in or package that executed the following line of code:

    Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US")

    And then, all assemblies in Visual Studio run their code in another locale. 

    Try to turn off another add-ins and try again.


    Thank you,
    Misha Zhutov
    http://submain.com - .NET Developer Tools | Microsoft VB MVP
  •  12-14-2009, 5:51 PM 1036 in reply to 1031

    Re: Date format in environment macros

    I had ReSharper 5.0 nightly build installed. When I uninstalled it, GhostDoc worked correctly. When I reinstalled the latest ReSharper build, it started using the wrong date format again.

    I'll raise this as a bug with the ReSharper team. Thank you for your help with identifying the problem!!

    Alex.

  •  12-15-2009, 12:41 AM 1037 in reply to 1036

    Re: Date format in environment macros

    Not a problem, feel free to contact us if you have any questions.
    Thank you,
    Misha Zhutov
    http://submain.com - .NET Developer Tools | Microsoft VB MVP
    Filed under:
View as RSS news feed in XML
 
     
 
Home |  Products |  Services |  Download |  Purchase |  Support |  Community |  About Us |