locked
Localized Date Format RRS feed

  • Question

  • User1565008150 posted

    ToLongDateString EN-GB returns "10 June 2007"
    ToLongDateString EN-US returns "Sunday, June 10, 2007"

     For the sake of my site's consistance, someone please tell me how can I have EN-US to return only "June 10, 2007", without having "Sunday, " in front.
     

    Thursday, August 30, 2007 8:11 PM

Answers

  • User-989915499 posted

    Hi There,

    I don't you can do anything to change the DateTime.ToLongDateString()

    ToLongDateString() is equivalant to ToString("dddd, MMMM dd, yyyy")

    depends on the culture it will have different built-in formatstring.

    en-US = dddd, MMMM dd, yyyy

    en-GB = dd MMMM yyy

     

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, August 31, 2007 9:34 AM

All replies

  • User-989915499 posted

    Hi There,

    You can use of formatstring

    DateTime.ToString("MMMM dd, yyyy");

    For more information:

    http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx

    Thursday, August 30, 2007 9:32 PM
  • User-989915499 posted

    Hi There,

    Furthur to my previous reply.

    I don;t think you can get en-US without day of week. This is because the long date format is define within the class.

    Example:

    Response.Write((new System.Globalization.CultureInfo("en-US", false)).DateTimeFormat.LongDatePattern.ToString());Response.Write("<br/>");

     

    Response.Write((new System.Globalization.CultureInfo("en-GB", false)).DateTimeFormat.LongDatePattern.ToString());

    Response.Write("<br/>");

    Response.Write((new System.Globalization.CultureInfo("en-AU", false)).DateTimeFormat.LongDatePattern.ToString());

    Response.Write("<br/>");

    Try use of en-AU i think this is quite similar.

    Let me know this is help ! or we can try something else . ;)

    Thursday, August 30, 2007 10:07 PM
  • User1565008150 posted

    Well what I'm doing is get browser's culture and display the dates on my site using that culture. So It's not about the culture I use, is about the culture the user use so thats why I was wondering if there is a way to standardize it.

    Friday, August 31, 2007 9:17 AM
  • User-989915499 posted

    Hi There,

    I don't you can do anything to change the DateTime.ToLongDateString()

    ToLongDateString() is equivalant to ToString("dddd, MMMM dd, yyyy")

    depends on the culture it will have different built-in formatstring.

    en-US = dddd, MMMM dd, yyyy

    en-GB = dd MMMM yyy

     

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, August 31, 2007 9:34 AM
  • User1565008150 posted

    I have to find a work around then. Maybe there is a site which has all culture's date formats listed so I can see the ones having this problem so I know which cultures to replace ?

    Friday, August 31, 2007 5:13 PM