Convert YYYYMMDD string to MM/DD/YYYY string

前端 未结 4 1922
庸人自扰
庸人自扰 2021-01-06 09:27

I have a date that is stored as a string in the format YYYYDDMM. I would like to display that value in a \'MM/DD/YYYY\' format. I am programming in c#. The current code tha

4条回答
  •  醉梦人生
    2021-01-06 10:11

    You want the method DateTime.ParseExact.

    DateTime date31 = DateTime.ParseExact(strOC31date, "yyyyddMM", CultureInfo.InvariantCulture);
    

提交回复
热议问题