I converted to JSON using Newtonsoft.Json.dll, this time converting a collection into JSON, which has a datetime type of data,
Conversion completed will become/date (1286375605000+0800)/So, how can I convert it to a time format wow
<script type="Text/javascript">function Changedateformat (time) {if(Time! =NULL) { varDate =NewDate (parseint (Time.replace ("/date (",""). Replace (")/",""),Ten)); varmonth = Date.getmonth () +1<Ten?"0"+ (Date.getmonth () +1): Date.getmonth () +1; varcurrentdate = Date.getdate () <Ten?"0"+date.getdate (): Date.getdate (); returnDate.getfullyear () +"-"+ Month +"-"+currentdate; } return "";} Window.onload=function () {alert (Changedateformat ("/date (1286375605000+0800)/"));//Do you want?varDate =NewDate ("Sun Jan 2 00:00:00 utc+0800");d ate.getyear (); //get Current year (2-bit)Date.getfullyear ();//Get the full year (4-bit, 1970-????) Date.getmonth ();//Get the current month (0-11, 0 for January)Date.getdate ();//get current day (1-31)Date.getday ();//get Current week x (0-6, 0 for Sunday)Date.gettime ();//Get the current time (<a href= starting from 1970.1.1 )https://www.baidu.com/s?wd=%E6%AF%AB%E7%A7%92&tn=44039180_cpr&fenlei= Mv6quakxtzn0izrqihckpjm4nh00t1y1mwrknwr1rhnvpvndryn30zwv5hcvrjm3rh6spfkwumw85hfynjn4nh6sgvpst6kdthsqpzwytjceqlgcpyw9uz4bm Y-bii4wuvyetgn-tlwguv3ephbsphdzn1tl "target=" _blank "class=" baidu-highlight "> Milliseconds </a> number)Date.gethours ();//gets the current number of hours (0-23)Date.getminutes ();//gets the current number of minutes (0-59)Date.getseconds ();//gets the current number of seconds (0-59)Date.getmilliseconds ();//get current <a href= "https://www.baidu.com/s?wd=%E6%AF%AB%E7%A7%92&tn=44039180_cpr&fenlei= Mv6quakxtzn0izrqihckpjm4nh00t1y1mwrknwr1rhnvpvndryn30zwv5hcvrjm3rh6spfkwumw85hfynjn4nh6sgvpst6kdthsqpzwytjceqlgcpyw9uz4bm Y-bii4wuvyetgn-tlwguv3ephbsphdzn1tl "target=" _blank "class=" baidu-highlight "> Milliseconds </a> Number (0-999)Date.tolocaledatestring ();//Get Current datevarMytime=date.tolocaletimestring ();//Get current TimeDate.tolocalestring ();//get date and timealert (date.tolocalestring ());};</script>
JSON datetime conversion problem