得到明天的日期,需要帮助 [英] get date of tomorrow, need help

查看:87
本文介绍了得到明天的日期,需要帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿伙计们,我知道你会告诉我'在php中更容易做或者

即使在asp中也是如此,但我没有时间去学习它


1-我需要一个javascript来显示明天的日期

2-我需要一个能在2天内显示日期的javascript


实际上我有一个脚本向我显示当前日期....

它是:


< script>

var dayarray = new Array(Dimanche,Lundi,Mardi,Mercredi,Jeudi,Vendredi,Samedi)。 )
var montharray = new Array(Janvier,Février,Mars,Avril,Mai,Ju in,Juillet等)。 ,Ao?t,Septembre,Octobre,Novemb re,Décembre)


function getthedate(){

var mydate = new Date()

var year = mydate.getYear()

if(年< 1000)

年+ = 1900

var day = mydate.getDay()

var month = mydate.getMonth()

var daym = mydate.getDate()

if(daym< 10)

daym =" 0" + daym


var cdate ="< small>< font color =''000000''

face =''Arial''>< b>" + dayarray [day] + QUOT; " + daym + QUOT; " + montharray [month] +"

" + year +"< / b>< / font>< / small>"


if(document.all)

document.all.clock.innerHTML = cdate

else if(document.getElementById)

document.getElementById(" clock")。innerHTML = cdate

else

document.write(cdate)

}

if(!document.all&&!document.getElementById)

getthedate()

function goforit(){

if (document.all || document.getElementById)

setInterval(" getthedate()",1)

}

< /脚本>

< span id =" clock">< / span>


例如,我希望它显示:

2004年5月3日星期一(当前日期)

2004年5月4日星期二

2004年5月5日星期三

我需要它在javascript plz :)


Thx为您提供帮助。


-Frank

解决方案

Fran?ois Laroche写道:

嘿伙计们,我知道你会告诉我'在php或
中更容易做,即使在asp中,但是我只是没有时间学习它

1-我需要一个能显示明天日期的javascript
2-我需要一个能在2天内显示日期的javascript



< snip>


函数getnewdate(天){

var now = new Date();

var daylength = 1 * 24 * 60 * 60 * 1000;

var then = new Date(现在* 1 + daylength *天);

提醒(''现在''+现在+''\ n''然后');

}


代码来源: http://www.codingforums.com/showthread.php?t=37338


2004年5月3日星期一18:37:29 -0700,mscir

< ms *** @ access4less。 com.net.org.uk>写道:

Fran?ois Laroche写道:

嘿伙计们,我知道你会告诉我'在php或
1-我需要一个能显示明天日期的javascript
2-我需要一个能显示的javascript 2天内的日期


< snip>

函数getnewdate(days){
var now = new Date();
var daylength = 1 * 24 * 60 * 60 * 1000;
var then = new Date(现在* 1 + daylength *天);
alert(''now''+ now +''\ nhen''+ +然后);
}




哇,这真是太复杂了。尝试


函数dateDaysFromNow(天){

var d = new Date();

d.setDate(d.getDate ()+天);

返回d;

}


迈克


-

Michael Winter
M.******@blueyonder .co.inva lid(将.invalid替换为.uk以回复)


Michael Winter写道:

mscir写道:

Fran?ois Laroche写道:

嘿伙计们,我知道你会告诉我'在php中更容易做或者即使在asp中,但我没有时间学习它

1-我需要一个能显示明天日期的javascript
2-我需要一个javascript将在2天内显示日期



< snip>

函数getnewdate(days){
var now = new Date();
var daylength = 1 * 24 * 60 * 60 * 1000;
var then = new Date(现在* 1 + daylength *天);
alert(''now''+ now +''\\\hen''+ then);
}



哇,这太复杂了。尝试

函数dateDaysFromNow(天){
var d = new Date();
d.setDate(d.getDate()+ days);
返回d ;
}




如果我今天(5月04日)加5天,我会得到6月14日:


function dateDaysFromNow(天){

var d = new Date();

d.setDate(d.getDate()+ days);

警报(d);

}


迈克


hey guys, I know that you will tell me that''s easier to do in php or
even in asp, but I just dont have the time to learn it

1- I need a javascript that will show the date of tomorrow
2- I need a javascript that will show the date in 2 days

actually I have a script that show me the current date....
there it is:

<script>

var dayarray=new Array("Dimanche","Lundi","Mardi","Mercredi","Jeudi ","Vendredi","Samedi")
var montharray=new Array("Janvier","Février","Mars","Avril","Mai","Ju in","Juillet","Ao?t","Septembre","Octobre","Novemb re","Décembre")

function getthedate(){
var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym

var cdate="<small><font color=''000000''
face=''Arial''><b>"+dayarray[day]+" "+daym+" "+montharray[month]+"
"+year+"</b></font></small>"

if (document.all)
document.all.clock.innerHTML=cdate
else if (document.getElementById)
document.getElementById("clock").innerHTML=cdate
else
document.write(cdate)
}
if (!document.all&&!document.getElementById)
getthedate()
function goforit(){
if (document.all||document.getElementById)
setInterval("getthedate()",1)
}
</script>
<span id="clock"></span>

For example, I want it to show:
Monday, May 03, 2004(current date)
Tuesday, May 04, 2004
Wednesday, May 05, 2004

I need it in javascript plz :)

Thx for your help.

-Frank

解决方案

Fran?ois Laroche wrote:

hey guys, I know that you will tell me that''s easier to do in php or
even in asp, but I just dont have the time to learn it

1- I need a javascript that will show the date of tomorrow
2- I need a javascript that will show the date in 2 days


<snip>

function getnewdate(days){
var now = new Date();
var daylength= 1*24*60*60*1000;
var then = new Date(now*1+daylength*days);
alert(''now ''+now+''\nthen ''+then);
}

code source: http://www.codingforums.com/showthread.php?t=37338


On Mon, 03 May 2004 18:37:29 -0700, mscir
<ms***@access4less.com.net.org.uk> wrote:

Fran?ois Laroche wrote:

hey guys, I know that you will tell me that''s easier to do in php or
even in asp, but I just dont have the time to learn it

1- I need a javascript that will show the date of tomorrow
2- I need a javascript that will show the date in 2 days


<snip>

function getnewdate(days){
var now = new Date();
var daylength= 1*24*60*60*1000;
var then = new Date(now*1+daylength*days);
alert(''now ''+now+''\nthen ''+then);
}



Wow that''s unnessarily complicated. Try

function dateDaysFromNow( days ) {
var d = new Date();
d.setDate( d.getDate() + days );
return d;
}

Mike

--
Michael Winter
M.******@blueyonder.co.invalid (replace ".invalid" with ".uk" to reply)


Michael Winter wrote:

mscir wrote:

Fran?ois Laroche wrote:

hey guys, I know that you will tell me that''s easier to do in php or
even in asp, but I just dont have the time to learn it

1- I need a javascript that will show the date of tomorrow
2- I need a javascript that will show the date in 2 days



<snip>

function getnewdate(days){
var now = new Date();
var daylength= 1*24*60*60*1000;
var then = new Date(now*1+daylength*days);
alert(''now ''+now+''\nthen ''+then);
}



Wow that''s unnessarily complicated. Try

function dateDaysFromNow( days ) {
var d = new Date();
d.setDate( d.getDate() + days );
return d;
}



If I add 5 days to today (May 04) I get Jun 14:

function dateDaysFromNow(days) {
var d = new Date();
d.setDate(d.getDate() + days);
alert(d);
}

Mike


这篇关于得到明天的日期,需要帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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