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

后端 未结 6 673
[愿得一人]
[愿得一人] 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条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-11 18:01

    On the string, when you display the date, do the following:

    CultureInfo ci = new CultureInfo("en-US");
    string s = dateTimeObject.ToString(ci);
    

    This is a simplified example however, you just need to do the necessary work you want to do on the DateTime object.

提交回复
热议问题