关于日期的计算的小问题,在线等.............

mingday 2003-04-30 11:41:54
数据库中一字段日期时间型,我想给这个值加上一个时间,如30分钟,如何实现

...全文
22 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
cqfeng 2003-04-30
  • 打赏
  • 举报
回复
sql server
DATEADD ( datepart , number, date )

示例
此示例打印出 pubs 数据库中标题的时间结构的列表。此时间结构表示当前发布日期加上 21 天。

USE pubs
GO
SELECT DATEADD(day, 21, pubdate) AS timeframe
FROM titles
GO

minute 缩写 mi
meizz 2003-04-30
  • 打赏
  • 举报
回复
DateAdd("n", 30, "2003-4-30 14:54:23")
tigerwen01 2003-04-30
  • 打赏
  • 举报
回复
用函数:
DateAdd()
 FUNCTION: 返回一个被改变了的日期。
 SYNTAX: DateAdd(timeinterval,number,date)
 ARGUMENTS: timeinterval is the time interval to add; number is amount of
time intervals to add; and date is the starting date.
 EXAMPLE: <%
currentDate = #8/4/99#
newDate = DateAdd("m",3,currentDate)
response.write newDate
%>

<%
currentDate = #12:34:45 PM#
newDate = DateAdd("h",3,currentDate)
response.write newDate
%>
 RESULT: 11/4/99
3:34:45 PM

"m" = "month";
"d" = "day";

If currentDate is in time format then,
"h" = "hour";
"s" = "second";

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧