JSON datetime conversion problem

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.