How to parse date format?

后端 未结 2 974
盖世英雄少女心
盖世英雄少女心 2021-01-17 06:43

In one of the webservices my application is consuming, I encountered the following DateTime format.

\"/Date(1395780377459)/\"

Is this some stand

2条回答
  •  旧巷少年郎
    2021-01-17 07:12

    I think the date is in milliseconds format. So you can try this:

    DateTime date = new DateTime(long.Parse(1395780377459));
    date.ToString("yyyy-MM-ddThh:mm:ssZ");
    

    or simply

    var time = TimeSpan.FromMilliseconds(1395780377459);
    

    Also the if the date is in json format then you may try this as mentioned in this answer:

    var date = new Date(parseInt(jsonDate.substr(6)));
    

提交回复
热议问题