Fix applet in Data.parse () get timestamp iOS incompatible

Source: Internet
Author: User

Since the time stamp must be compared with the background interface, the foreground gets the timestamp first. The first is to get the phone local time, but the user changed the time to waste .....

Later on from the server to get time to convert to timestamp (is not very fucked, first get on the server in the TM comparison), but the background directly to me a time stamp is not finished it?

Just give me a moment to turn around and the problem comes.

[CSharp]View PlainCopy
    1. var resdata = ' 2017-3-14 10:03:45 '
    2. Console.log ("return time:" + resdata)
    3. var time = Date.parse (new Date (Resdata))/1000;

This way, development tools, mobile phone development, mobile experience version are no problem. But I am poor and a use of the Android phone, with the Apple said nothing ... Then start looking for the problem and find out that iOS gets the time converted Nan.
The first time the mobile phone end .....
All kinds of degrees Niang after know, Crooked Fruit founder Interbank FX only recognize 2017/3/14.
Instead, replace can only replace the first one, and the regular all

[CSharp]View PlainCopy
      1. var resdata = ' 2017-3-14 10:03:45 ';
      2. Resdata=resdata.  Replace (/-/g, '/');
      3. Console.log ("return time:" + resdata);
      4. var time = Date.parse (new Date (Resdata))/1000;

var data1 = new Date ();
var data2 = parseint (Data1.gettime ()/1000);
Console.log (DATA2)
var stringTime1 = "2017/08/16 10:00:00";
var stringTime2 = "2017/09/30 11:59:00";
var timestamp1 = date.parse (new Date (stringTime1));
TIMESTAMPS1 = timestamp1/1000;
TIMESTAMPS2 = timestamp2/1000;
Alert (data1+ ":" +data2+ ":" +timestamps1+ ":" +TIMESTAMPS2)
Alert (typeof (Data2) + ":" +typeof (TIMESTAMPS1) + ":" +typeof (TIMESTAMPS2))

Fix applet in Data.parse () get timestamp iOS incompatible

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.