在报表中要求把报表中的日期转换成星期格,但用DateTime.DayOfWeek转换出来后是英文,求怎样转成汉字形式呀,急,在线等待

解决方案 »

  1.   

    WeekdayName(周几,是否缩写, 第一天是周几)
      

  2.   

    System.Threading.Thread currentThread = System.Threading.Thread.CurrentThread;
    System.Globalization.CultureInfo cultureInfo = (System.Globalization.CultureInfo)currentThread.CurrentCulture.Clone(); 
    string buffer = cultureInfo.DateTimeFormat.GetAbbreviatedDayName(System.DayOfWeek.Friday);//buffer =星期五
      

  3.   

    try..Console.WriteLine(System.DateTime.Now.GetDateTimeFormats('D')[2].Substring (0,3).ToString ());
      

  4.   

    string str=System.DateTime.Now.GetDateTimeFormats('D')[2].Substring (0,3).ToString ();
      

  5.   

    System.Globalization.CultureInfo cultureInfo = new CultureInfo("zh-CN");
    string buffer = cultureInfo.DateTimeFormat.GetAbbreviatedDayName(System.DayOfWeek.Friday);
    这样在英文环境下也可以得到正确的
      

  6.   

    string str=System.DateTime.Now.GetDateTimeFormats('D')[2].Substring (0,3).ToString ();输出:星期二
      

  7.   


                System.Globalization.CultureInfo cultureInfo = new System.Globalization.CultureInfo("zh-CN");
                textBox1.Text = cultureInfo.DateTimeFormat.GetAbbreviatedDayName(dt.DayOfWeek).ToString();            textBox1.Text = dt.GetDateTimeFormats('D')[2].Substring(0, 3).ToString();
      

  8.   

    switchi can do it only in this way.
      

  9.   

    Console.WriteLine(System.DateTime.Now.GetDateTimeFormats('D')[2].ToString());
            
    这个 谁能给我讲讲'D'代表什么
      

  10.   

    格式字符 
     关联属性/说明 
     

     ShortDatePattern 
     

     LongDatePattern 
     

     完整日期和时间(长日期和短时间) 
     

     FullDateTimePattern(长日期和长时间) 
     

     常规(短日期和短时间) 
     

     常规(短日期和长时间) 
     
    m、M 
     MonthDayPattern 
     
    r、R 
     RFC1123Pattern 
     

     使用当地时间的 SortableDateTimePattern(基于 ISO 8601) 
     

     ShortTimePattern 
     

     LongTimePattern 
     

     UniversalSortableDateTimePattern 用于显示通用时间的格式 
     

     使用通用时间的完整日期和时间(长日期和长时间) 
     
    y、Y 
     YearMonthPattern 
     
      

  11.   

    最好别使用GetDateTimeFormats方法,因为不同操作环境会不一样的。
      

  12.   

    string week = yourDateTime.ToString("dddd", new System.Globalization.CultureInfo("zh-CN"));