DateTime formatting using C# in Windows 7 RRS feed

  • Question

  • If this is not the appropriate place for this please let me know where and I will repost, but it seemed to be the most reasonable.

    For a work around to this issue please visit the question on http:// stackoverflow.com/questions/16923799/c-sharp-datetime-format

    (Sorry the above is not a link, my account has not been verified :( )

    Assume the date for below is May 12, 2013.

    I have a webpage that needs to use a short date.  One of my clients has modified their calendar to display their date with the day of the week.  In the process they modified the local short date format.  The date.ToShortDateString() converts this as it should, just not correct for the code.  So I tried String.Format("{0:MM/dd/yy}", date) and the result "05 12 13", there are spaces where there should be forward slashes.

    The solution that I would expect for this is setting the CultureInfo.GetCultureInfo("en-US").   This does not set the forward slashes.  Setting the CultureInfo.InvariantCulture does allow this to work.  This would mean that the CultureInfo.GetCultureInfo("en-US") does not force the format of the date but instead uses the computers format.

    Is the en-US culture info supposed to format the date to the same format each time or can that be thrown out the window if someone changes settings on their machine?

    Tuesday, June 4, 2013 7:13 PM


All replies

  • The application development forums are located @ www.msdn.com

    This is an end user forum.

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. ”

    Tuesday, June 4, 2013 8:07 PM
  • Rick Dee,

    Thank you for mentioning that.  MSDN does not have categories for Operating Systems.  I have confirmed that this does not happen in Windows 8 and that it does happen on Server 2008 R2 (Kind of expected).  So that is why I feel this is a Windows issue and not a code issue.  The Connect.Microsoft.com site is not currently accepting feedback or I would post there.



    Wednesday, June 5, 2013 2:18 PM
  • Hi,

    Since this issue is related to the code, I also suggest you post it in MSDN forum for more help.

    Also, for feedback, you can check the following link:



    Vincent Wang
    TechNet Community Support

    Thursday, June 6, 2013 2:26 AM