Javascript日期和他们的操纵 [英] Javascript dates and their manipulation

查看:54
本文介绍了Javascript日期和他们的操纵的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了几个有while的脚本。如果日期与一组日期中的一个日期不匹配,则会将

日期增加一天。

但是,有时它显然会逐步退出while循环虽然我的病情没有得到满足,但是
。会工作几个循环然后逐步走出

经常。

是否有javascript" date"问题是什么?我还注意到Firefox和Internet Explorer之间的结果不同。


感谢任何评论,


pj 。 。 。

I''ve written several scripts that have "while" blocks which increment a
date by one day if the date does not match one of a group of dates.
However, sometimes it apparently steps out out the while loop even
though my condition isn''t met. Will work for a few loops then steps out
often.
Are there javascript "date" issues? I have also noticed different
results between Firefox and Internet Explorer.

thanks for any comments,

pj . . .

推荐答案

2004年11月8日星期一19:54:35 GMT,Peter Pfeiffer写道:
On Mon, 08 Nov 2004 19:54:35 GMT, Peter Pfeiffer wrote:
我写了几个有同时的脚本。如果日期与一组日期中的一个日期不匹配,则会将日期增加一天。
然而,有时它显然是


你的代码显然是什么它实际上完全是次要的,而且当代码存在时,这是最明显的,

或更好,仍然链接到一个示例URL。 />
..虽然我的条件没有得到满足,但仍然会在while循环中退出。会工作几个循环,然后经常走出去。
是否有javascript" date"问题?
I''ve written several scripts that have "while" blocks which increment a
date by one day if the date does not match one of a group of dates.
However, sometimes it apparently
What your code apparently does is entirely secondary to what it
actually does, and that is most apparent when the code is present,
or better still, linked to at an example URL.
..steps out out the while loop even
though my condition isn''t met. Will work for a few loops then steps out
often.
Are there javascript "date" issues?




''javascript''日期问题?可能,最近有一位日期大师'

在这里,正在思考他在JS日期函数中获得的差异,因为它在各种UA中运行是的。


应该注意的是,这是一个神秘且不寻常的b $ b b情形,而99(.9)%的有趣小''日期''

问题不是由于该工具的

部分(在本例中为JS)中的神秘失败造成的,而是基本的

理解一件非常复杂的事情(日期)。


为了更好地理解日期的整个问题,

你可以检查一下网站链接JS常见问题..

< http://www.merlyn.demon.co.uk/js-dates.htm>

(由...撰写''日期大师''如上所述)


HTH


-

Andrew Thompson
http://www.PhySci.org/codes/ Web& IT帮助
http://www.PhySci.org/ 开源软件套件
http://www.1point1C.org/ Science&技术
http://www.LensEscapes.com/ 图像逃脱世界各地



''javascript'' date issues? Possibly, one of the date guru''s
was here recently, musing over the differences he was getting
on a JS date function as operated across a variety of UA''s.

It should be noted that it was an arcane and unusual
situation though, and that 99(.9)% of funny little ''date''
issues are caused not so much by arcane failings on the
part of the tool (JS, in this instance), so much as a basic
understanding of a very complex thing (dates).

For a better understanding of the entire matter of dates,
you might check the site linked from the JS FAQ..
<http://www.merlyn.demon.co.uk/js-dates.htm>
(authored by the ''date guru'' mentioned above)

HTH

--
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.LensEscapes.com/ Images that escape the mundane


2004年11月8日星期一20:22:59 GMT,Andrew Thompson< Se ******** @ www.invalid>

写道:


[snip]
On Mon, 08 Nov 2004 20:22:59 GMT, Andrew Thompson <Se********@www.invalid>
wrote:

[snip]
你的代码显然完全是次要的,它实际上是什么
当代码存在时,或者更好的
仍然链接到示例URL时,这是最明显的。


我肯定可以说得更简单。 :)


[snip]

[...]最近有一位日期大师在这里,对
差异进行思考他正在使用各种UA的JS日期功能。

应该注意的是,这是一个神秘而不寻常的情况,
[ ...]
What your code apparently does is entirely secondary to what it actually
does, and that is most apparent when the code is present, or better
still, linked to at an example URL.
I''m sure that could be phrased far more simply. :)

[snip]
[...] one of the date guru''s was here recently, musing over the
differences he was getting on a JS date function as operated across a
variety of UA''s.

It should be noted that it was an arcane and unusual situation though,
[...]




没有那么多不寻常,但没有说明。 ECMAScript标准没有b $ b指定实现应该接受的日期格式,

以及与字符串相关的格式应该生成什么格式。唯一的

规定是


d.valueOf()= Date.parse(d.toString())= Date.parse(d.toUTCString( ))


也就是说,实现产生的任何字符串也应该是可解析的。


假设某些标准是合理的格式应该正确解释为

,例如yyyy-mm-dd hh:mm:ss,但它不是由常识以外的其他任何东西保证的。
。 br />

[snip]


Mike


-

迈克尔冬天

替换.invalid与.uk通过电子邮件回复。



Not so much unusual, but unspecified. The ECMAScript Standard doesn''t
specify anything about the date formats an implementation should accept,
nor what format string-related methods should produce. The only
stipulation is that

d.valueOf() = Date.parse(d.toString()) = Date.parse(d.toUTCString())

That is, any string produced by an implementation should also be parsable.

It''s reasonable to assume that certain standard formats should be
correctly interpreted, such as yyyy-mm-dd hh:mm:ss, but it''s not
guaranteed by anything other than common sense.

[snip]

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.


2004年11月8日星期一22:08:40 GMT,Michael Winter写道:
On Mon, 08 Nov 2004 22:08:40 GMT, Michael Winter wrote:
你的代码显然完全是次要的,它实际上是什么,当代码存在时,或者更好的代码仍然链接到示例网址。
What your code apparently does is entirely secondary to what it actually
does, and that is most apparent when the code is present, or better
still, linked to at an example URL.



我相信可以更简单地措辞。 :)



I''m sure that could be phrased far more simply. :)




知道我本应该去的..


''< http://www.physci。组织/代码/ sscce.jsp> ''


(感谢Earthling的帮助,它被翻译成了一个普通的人类语言。)

>
-

Andrew Thompson
http://www.PhySci.org/codes/ Web& IT帮助
http://www.PhySci.org/ 开源软件套件
http://www.1point1C.org/ Science&技术
http://www.LensEscapes.com/ 图像逃脱世俗的



Knew I should have gone with..

'' <http://www.physci.org/codes/sscce.jsp> ''

( Thanks to the help of an Earthling, it has been translated
to a common human language.. )

--
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.LensEscapes.com/ Images that escape the mundane


这篇关于Javascript日期和他们的操纵的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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