iOS与Android:同一程序显示的日期不同 [英] iOS vs Android: different dates displayed for the same program

查看:156
本文介绍了iOS与Android:同一程序显示的日期不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个JavaScript代码:

I have a javascript code:

newDate: function(days) {
    var newDate = new Date( parseInt(startDate) + 1*1000*3600);

    var date = newDate .getDate();
    return date ;
},

似乎是程序的一部分,在Android和iOS上产生不同的结果.其余所有数据都相同. 在Android和iOS上如何产生不同的结果?

Seems like this is the part of the program that produces different results on Android and iOS. All the rest data is the same. How can it produce different results on Android vs iOS?

推荐答案

对于以下日期格式,Date构造函数仅是一致的跨浏览器:

The Date constructor is only consistent cross-browser for the following Date formats:

"2010"

"2010-06"

"2010-06-09"

"2010-06-09T15:20:00Z"

"2010-06-09T15:20:00-07:00"

"2010/06/09"

"2009/6/9"

"2010/6/9 12:34"

"2010/6/9 12:34:56"

"June 9, 2010"

"2010 June 9"

参考

JavaScript日期解析在ES6

如何在JavaScript中输出ISO 8601格式的字符串?

哪种日期格式符合IETF的RFC 2822时间戳?

时间编程

日期时间戳准则(pdf)

时区和夏时制数据的来源

这篇关于iOS与Android:同一程序显示的日期不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆