How do I format date as 10-Jan-1971 when regional setting is not English

This is a discussion on How do I format date as 10-Jan-1971 when regional setting is not English within the C# Programming forums, part of the General Programming Boards category; I have a Windows with Regional settings - Hebrew I have a consol application and I have Code: System.DateTime date ...

  1. #1
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,470

    How do I format date as 10-Jan-1971 when regional setting is not English

    I have a Windows with Regional settings - Hebrew
    I have a consol application

    and I have
    Code:
    System.DateTime date = new System.DateTime(1971,1,10);
    System.Consol.WriteLine (date.ToString("dd-MMM-yyyy"));
    Which outputs some strange non-readable symbols instead of short month name.

    I'd like to see a month name or in Hebrew - or (preffered) ignoring regional settings of the windows - in English

    How do I do it?

    PS. I DO know how to output month as a number. I need a name.
    I have tried to change the CodePage of the Consol - no success.
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  2. #2
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,470

    Found answer

    Aded at the beginning of the Main

    Code:
                    System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-us",false);
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. 100000 women
    By Snafuist in forum A Brief History of Cprogramming.com
    Replies: 36
    Last Post: 05-27-2009, 07:41 AM
  2. reading a file
    By nhubred in forum C++ Programming
    Replies: 3
    Last Post: 05-21-2009, 11:34 AM
  3. A-Star Pathfinding
    By mike_g in forum General AI Programming
    Replies: 1
    Last Post: 08-05-2007, 04:18 PM
  4. Segmentation Fault
    By Lost__Soul in forum C Programming
    Replies: 46
    Last Post: 04-28-2003, 04:24 AM
  5. Scheduling Algo
    By BigDaddyDrew in forum C++ Programming
    Replies: 41
    Last Post: 03-08-2003, 10:00 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21