1 public static string DateTimeFormat(string signDateStyle, string signDate)
 2   
 3       {
 4           
 5   switch (signDateStyle)//
 6        
 7      {
 8               
 9   case "0":
10               
11       signDate = Convert.ToDateTime(signDate).ToString("yyyy-MM-dd", DateTimeFormatInfo.InvariantInfo);
12  
13                    break;
14              
15    case "1":
16                   
17   signDate = Convert.ToDateTime(signDate).ToString("yyyy年MM月dd日", DateTimeFormatInfo.InvariantInfo);
18  
19                    break;
20              
21    case "2":
22                    
23  signDate = Convert.ToDateTime(signDate).GetDateTimeFormats('g')[0].ToString();//yyyy-MM-dd HH:mm
24    
25                  break;
26       
27           case "3":
28            
29          signDate = Convert.ToDateTime(signDate).ToString("yyyy年MM月dd日 HH时mm分",DateTimeFormatInfo.InvariantInfo);
30                     break;
31              
32    case "4":
33             
34         signDate = Convert.ToDateTime(signDate).ToString("yyyy-MM-dd HH:mm:ss",DateTimeFormatInfo.InvariantInfo);
35   
36                   break;
37            
38      default:
39                  
40    break;
41            
42  }
43         
44     return signDate;
45    
46      }

 

posted on 2021-02-24 11:50  梦想&现实  阅读(190)  评论(0编辑  收藏  举报