免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2036 | 回复: 3
打印 上一主题 下一主题

请教informix 下的时间计算方法 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2004-08-09 12:51 |只看该作者 |倒序浏览
我想实现以下语句
select (current year to month + interval(u_month - 1) month to month)  from tm_currenttime;
select (current year to day + interval(u_day ) day to day)  from tm_currenttime;

但是interval的参数必须要是常数,不能是变量
能不能够用别的方法来实现
主要是想让数据库自己判断是如果加的月超过一年,系统自动在年上加一年
如果加的天超过一个月,系统自动在月上加一月

论坛徽章:
0
2 [报告]
发表于 2004-08-09 15:22 |只看该作者

请教informix 下的时间计算方法

顶一下,关注中......

论坛徽章:
0
3 [报告]
发表于 2004-08-09 16:23 |只看该作者

请教informix 下的时间计算方法

原帖由 "white.fox" 发表:
我想实现以下语句
select (current year to month + interval(u_month - 1) month to month)  from tm_currenttime;
select (current year to day + interval(u_day ) day to day)  from tm_currenttime;

但是i..........


select  current year to month + u_month units month  from tm_currenttime;
select  current year to day + u_day units  day  from tm_currenttime;

u_month、u_day 可以是数值型或字符型,只要能够转换成整型。

论坛徽章:
0
4 [报告]
发表于 2004-08-10 13:28 |只看该作者

请教informix 下的时间计算方法

这个方法使我受用很多,应该可以用到其他地方吧
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP