English 中文(简体)
Java 文本:Nov和12月的新日期格式没有使用
原标题:Java Script: New Date Format is not working for Nov and December
  • 时间:2011-11-23 13:14:30
  •  标签:
  • javascript

我正试图改变我的日期格式。

                var d = new Date();
                var curr_year = d.getFullYear();
                var curr_Month = d.getMonth() +1;
                var curr_date = d.getDate();
                var todayDate =  var tDate =   ( curr_Month +"/"+curr_date +"/"+ curr_year);

这完全是罚款的,11月份是10个,而不是11个,12月份是11个而不是12个。

注: 这个问题只在 mo和歌剧中,在互联网上探索其工作标准!

任何设想

增 编

最佳回答

对我来说,这项作品的罚款是11/23/2011。 现在是我的时区截至这一答复的目前日期,尽管我们接受了美国的格式:-

检测结果见E/C.5/62/8和E9, 并附有以下超文本:

<html><head></head><body><script language="javascript">
var d = new Date();
var curr_year = d.getFullYear();
var curr_Month = d.getMonth() + 1;
var curr_date = d.getDate();
var todayDate =  (curr_Month + "/" + curr_date + "/" + curr_year);
alert (todayDate);
</script></body></html>

您的最后一行不是yn子。 我前面已经看到,事实上,它停止了文字工作。 在IE9中,你获得:

SCRIPT1002: Syntax error xyz.html, line 6 character 18

页: 1

[23:12:17.613] syntax error @ file:///C:/Users/Pax/Documents/xyz.html:6
问题回答

您的代码应为:>11/23/2011>而无错误。

关于<代码>Date 要素,抵达蒙特里(0>。 And Jan - 页: 1

Reference

抵达蒙特里

按当地时间分列的月(0-11)返回。

It seems perfectly fine here. What browser do you use (although I don t think it matters)?





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签