日期和时间 [英] Date and time
问题描述
说我给这样的日期和时间:
Jun-15-04 21:52:06
这是我的表格使用:
< form>
< p>< input type =" text"名称= QUOT; T1" size =" 20">< br>
date< / p>
< p>< input type =" text"名称= QUOT; T2" size =" 20">< br>
从日期算起90天< / p>
< p>< input type =" submit"值= [提交" name =" B1">< / p>
< / form>
我怎样才能在90天后显示日期确切的日期和时间。
我会在第一个框中输入数据并点击提交显示在第二个
框中。
TIA
Samir说:
说我给这样的日期和时间:
Jun-15-04 21:52:06
这是我正在使用的表格:
< form>
< p>< input类型= QUOT;文本"名称= QUOT; T1" size =" 20">< br>
date< / p>
< p>< input type =" text"名称= QUOT; T2" size =" 20">< br>
90天后< / p>
< p>< input type =" submit"值= [提交" name =" B1">< / p>
< / form>
我怎样才能在90天后将日期显示到确切的日期和时间。我会在第一个框中输入数据并点击提交以显示在第二个
框中。
如果你不打算将数据发送到您的服务器,
您不应该使用submit元素。请改为输入类型为
" button"
< input type =" button"
value ="提交"
onclick =" this.form.date2.value = plus90(this.form.da te1.value)">
T1和T2和T2。 (和B1)是表单字段的非常糟糕的名称。
为什么不至少date1和'date2'?
至于我称之为plus90()的函数应该做什么,
检查引用的日期操作链接常见问题:
http://www.jibbering.com/faq/
您可能想重新考虑输入格式。
如果格式为2004年6月15日21:52:06,那就容易多了;
Lee于2004年8月19日在comp.lang.javascript中写道 :
萨米尔说:
说我给这样的日期和时间:
Jun-15-04 21:52:06
您可能需要重新考虑输入格式。
如果格式为Jun 15 2004 21:52:06,则会更容易。
很多??
t =" Jun-15-04 21:52:06"
t = t.replace(/ - (\d\d)/," 20
Say I put a date and time for like this:
[允许上个世纪为19 ..]
-
Evertjan。
荷兰。
(请将我的电子邮件地址中的x'变为点数)
Jun-15-04 21:52:06
Here is the form I am using:
<form>
<p><input type="text" name="T1" size="20"><br>
date</p>
<p><input type="text" name="T2" size="20"><br>
90 days from date</p>
<p><input type="submit" value="Submit" name="B1"></p>
</form>
How could I get to show the date 90 days later to the exact date and time.
I would enter the data in the first box and hit submit to show in the second
box.
TIASamir said:
Say I put a date and time for like this:
Jun-15-04 21:52:06
Here is the form I am using:
<form>
<p><input type="text" name="T1" size="20"><br>
date</p>
<p><input type="text" name="T2" size="20"><br>
90 days from date</p>
<p><input type="submit" value="Submit" name="B1"></p>
</form>
How could I get to show the date 90 days later to the exact date and time.
I would enter the data in the first box and hit submit to show in the second
box.
If you''re not going to be sending the data to your server,
you shouldn''t use a submit element. Use an input of type
"button", instead.
<input type="button"
value="Submit"
onclick="this.form.date2.value=plus90(this.form.da te1.value)">
"T1" and "T2" (and "B1") are pretty bad names for form fields.
Why not at least "date1" and "date2"?
As for what the function I''ve called plus90() should do,
check the date manipulation links referenced in the FAQ:
http://www.jibbering.com/faq/
You may want to rethink the input format.
It''s a lot easier if the format is "Jun 15 2004 21:52:06".
Lee wrote on 19 aug 2004 in comp.lang.javascript:
Samir said:
Say I put a date and time for like this:
Jun-15-04 21:52:06You may want to rethink the input format.
It''s a lot easier if the format is "Jun 15 2004 21:52:06".
A lot??
t = "Jun-15-04 21:52:06"
t = t.replace(/-(\d\d) /," 20
1 ").replace(/-/g," ")
[allows also last century as 19..]
--
Evertjan.
The Netherlands.
(Please change the x''es to dots in my emailaddress)
这篇关于日期和时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!