| ■39561 / inTopicNo.7) | 
               Re[3]: DateTime型で「10th Aug 2009」と表示する | 
             
          
         
        
        □投稿者/ やじゅ (1203回)-(2009/08/11(Tue) 00:47:12) 
  
        
          
            
              
                 | 
                ■No39555 (sanae さん) に返信 > しかしながら、thをReplaceして表現しているってことは、ひょっとして、そう書かないとだめなのでしょうか。 > めんどうなので列挙しちゃいました。 > DateTime.Now.ToString("dd? MMM yyyy",new System.Globalization.CultureInfo("en-US")).Replace("?","th").Replace("1th","1st").Replace("2th","2nd").Replace("3th","3rd").Replace("11st","11th").Replace("12nd","12th"); >
  もりおさんが示した方法でもいいですね。'th'はシングルクォーテーションで囲めば良かったのか、ふむふむ。 DateTime.Now.ToString("dd'th' MMM yyyy", DateTimeFormatInfo.InvariantInfo)
  英語圏に慣れてないので、てっきり"th"だけかと思ってた・・・ 1st, 2nd, 3rd, 4th, 5th, 6th, 7th, 8th, 9th, 10th, 11th, etc 書式でそこまで対応してなさそうです、下記サイトはExcelではありますが、MODかSelectとかで処理してますね。 Ordinal numbers, and Ordinal numbers in dates (#ordinal) http://www.mvps.org/dmcritchie/excel/datetime.htm
  | 
               
            
           
         
        解決済み 
       |