Search code examples
c#compact-framework

How to display date in custom format with Compact Framework


I need to display a date using the Compact Framework, in the following format :

TUE,02/16


Solution

  • Use this

    Dictionary<string,string> days = new Dictionary<string,string>();
    days.Add("Monday", "MON");
    days.Add("Tuesday", "TUE");
    days.Add("Wednesday", "WED");
    days.Add("Thuesday", "THU");
    days.Add("Friday", "FRI");
    days.Add("Saturday", "SAT");
    days.Add("Sunday", "SUN");
    //Edit
    MessageBox.Show(days[DateTime.Now.DayOfWeek.ToString()] + DateTime.Now.ToString( " MM/dd"));