Converting string format to datetime in mm/dd/yyyy

前端 未结 6 1052
萌比男神i
萌比男神i 2020-11-27 18:39

I have to convert string in mm/dd/yyyy format to datetime variable but it should remain in mm/dd/yyyy format.

string strDate = DateTime.Now.ToString(\"MM/dd/         


        
6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-27 19:25

    You can change the format too by doing this

    string fecha = DateTime.Now.ToString(format:"dd-MM-yyyy");
    

    // this change the "/" for the "-"

提交回复
热议问题