Convert DateTime Format in C#

前端 未结 4 1582
攒了一身酷
攒了一身酷 2021-01-25 03:03

How can I convert this datetime format from a webservice. The datetime value is: \"timestamp\": \"2014-04-18T14:45:00+02:00\" I wan\'t to convert it to: dd.mm.YYYY hh.mm.ss

4条回答
  •  情歌与酒
    2021-01-25 03:36

    string date = "2014-04-18T14:45:00+02:00";
    var results = DateTime.ParseExact(s, "yyyy-MM-dd'T'HH:mm:ssK", CultureInfo.InvariantCulture);
    

提交回复
热议问题