Changing Date format to en-us while culture is fr-ca

后端 未结 6 586
[愿得一人]
[愿得一人] 2021-01-11 17:21

I\'m working on localizing a website in French. However I am not supposed to change the date format to French. It must remain as per en-us format even if the culture is set

6条回答
  •  伪装坚强ぢ
    2021-01-11 18:12

    Here is the above code in code snipet :

    CultureInfo ci = new CultureInfo("fr-ca"); 
    
    DateTimeFormatInfo dateformat = new DateTimeFormatInfo();
    
    
    
    dateformat.FullDateTimePattern = "ffffdd, mmmm dd, yyyy h:mm:ss tt";// Date format of en-us
    
    
    
    ci.DateTimeFormat = dateformat; 
    
    CultureAndRegionInfoBuilder obj = new CultureAndRegionInfoBuilder("fr-ca", CultureAndRegionModifiers.Replacement);
    
    
     obj.LoadDataFromCultureInfo(ci); 
    
    obj.Register();
    

提交回复
热议问题