当前位置: 首页 > 学习 > 电脑学习 > 网站开发 > ASP > ASP技巧 > 正文

asp怎么处理日期.from zdtips, in english

http://www.zk168.com.cn  招考学习网 2006-4-30 12:31:52
-----------------------------------------------------------[交流]-[打印]-[发送]-[收藏]--
Date manipulation with VBScript

Beyond simply displaying the date, VBScript provides a number of functions
that allow you to manipulate dates. The DateAdd(interval, number, date)
and DateDiff(interval, date1, date2) are helpful functions that are
usually left for the developer to write.

Both functions require you to pass an interval argument. This argument
specifies the time interval to add to the date or to compare the dates.
The DateAdd(interval, number, date) function returns a date that is the
specified number of intervals from the given date. The DateDiff(interval,
date1, date2) function returns the number of intervals between date1 and
date2.

There is also a handy function called DateSerial(year, month, day) that
returns a variant of the Date subtype. This function is very useful when
you need to create a date (such as Christmas) for use in the DateDiff()
function.

The following code shows these three functions in action:

<% dToday = Date() %>
In 10 days it will be
     <%= DateAdd("d", 10, dToday) %>
<P>
<% dChristmas = DateSerial(1998,12,25) %>

Christmas is just <%= DateDiff("d", dToday, dChristmas) %> days away!

From--ZD Journals' Active Server Developers Journal
-----------------------------------------------------------[交流]-[打印]-[发送]-[收藏]--
最新入库:
 
·10. 结束电话
·9 电话故障
·8. 分机、占线
·7. 打错电话
·6. 长途电话
·5. 转告消息
·4. 留 言
·3. 等候与回电
·2. 没找到人
·1. 打电话 接电话
相关内容:
 
·Wake-up Call Service 唤醒服务
·At the Barbers 在理发店与美容厅
·Maintenance 维修服务
·Settling complaints 处理投诉
·Laundry Service 洗衣服务
·At the Information Desk问讯处 2
·At the Information Desk问讯处 1
·The Bellman 应接服务员
·At the Reception Desk在接待处 2
·At the Reception Desk在接待处 1
网友点评:
 
会员名称:
密码:匿名 ·注册·忘记密码?
评论内容:
(最多300个字符)
  查看评论
友情提醒:
 1.库中的资料大都来自互联网、网友上传、各类书籍,在录入的过程中难免会出现错误,恳请网
 友来信指正!
 2.如果网友在本库中未能找到所需要的材料,请登陆到我们的论坛《招考学习网》版块!
 3.考友想加入招考学习网的编辑部,请发信到XueXiWang#Gmail.com(#改为@)附带个人简历
 4.如需转载请注明出处及作者,谢谢合作!
 5.如果您有更好的建议或意见请EMAIL:XueXiWang#Gmail.com (#改为@)
 6.凡标题中有注有“[NO]”字样均不含答案且答案整理中.
 7.如本库中转载文章涉及版权等问题,请相关网站或作者在两周内发邮件通知(EMAIL:  XueXiWang#Gmail.com (#改为@))我们,我们接到通知后立即删除该文章及链接!
你问我答 更多>>