string represents date, and reformat it

前端 未结 6 826
情书的邮戳
情书的邮戳 2020-12-21 17:45

The following case: There is a string that has this format \"2012-02-25 07:53:04\"

But in the end, i rather want to end up with this format \"25-02-2012 07:53:04\"

6条回答
  •  囚心锁ツ
    2020-12-21 18:02

    You can parse this as a date object and then provide the formatting you want when using the date.ToString method:

    date.ToString("dd-MM-yyyy hh:mm:ss");
    

提交回复
热议问题