| 编程中国 | 业界新闻 | 技术文章 | 视频教程 | 下载频道 | 程序源码 | 个人空间 | 编程论坛
全能ASP/PHP/ASP.NET主机,支持月付专业 MSSQL 数据库空间,支持月付专业 MySQL 数据库空间,支持月付学习型 ASP/PHP/ASP.NET 主机 30元/年
高端软件开发 = 年薪十万不是梦赛孚耐:软件保护加密专家身份认证令牌USB KEY 
共有 471 人关注过本帖
标题:已经郁闷了两天,请大虾们拯救啊!
收藏  订阅  推荐  打印 
哈马拟
Rank: 3Rank: 3
等级:中级会员
帖子:270
积分:2800
注册:2004-7-15
已经郁闷了两天,请大虾们拯救啊!

……

<select size="1" name="month_tq"> <% year_tq1=year_gl1 month_tq1=month_gl1 date_tq1=date_gl1 date1_str=date_tq1&"-"&month_tq1&"-"&year_tq1 date1=cdate(date1_str) date2=dateadd("d",1,date1) date2_str=cstr(date2) date_tq2=mid(date2_str,1,2) month_tq2=mid(date2_str,4,2) year_tq2=mid(date2_str,7,2) %> <option value="<%=month_tq1%>" selected><%=month_tq1%></option> <% if month_tq1<>month_tq2 then %> <option value="<%=month_tq2%>"><%=month_tq2%></option> <% end if %> </select></font><font size="2">月<select size="1" name="date_tq"> <option value="<%=date_tq1%>" selected><%=date_tq1%></option> <option value="<%=date_tq2%>"><%=date_tq2%></option> </select>日

……

在上述程序段中,year_tq1为形如"04"或"05"的字符串

而month_tq1为形如"01"——"12"的字符串

date_tq1为形如"01"——"31"的字符串

原想通过上述程序段实现下述功能:

上一工序的生产日期已知(假设为09月04日),则下一工序的生产日期要么为09月04日,要么为09月05日

可运行后,发现上述程序段并不能实现。且错得离普!

请大虾们不吝指教,程序段到底该怎么写啊?

搜索更多相关主题的帖子: 拯救  
2004-9-5 10:40
griefforyou
Rank: 12Rank: 12Rank: 12
等级:贵宾
威望:27
帖子:3338
积分:33882
注册:2004-4-15

2004-08-09 下一工序的生产日期 <select size="1" name="month_tq"> <% year_tq1="2004" month_tq1="08" date_tq1="09"

date1_str=year_tq1&"-"&month_tq1&"-"&date_tq1 date1=cdate(date1_str) date2=dateadd("d",1,date1)

date_tq2=datepart("d",date2) month_tq2=datepart("m",date2) year_tq2=mid("yyyy",date2)

if len(date_tq2)=1 then date_tq2="0" & date_tq2 if len(month_tq2)=1 then month_tq2="0" & month_tq2 %> <option value="<%=month_tq1%>" selected><%=month_tq1%></option> <% if month_tq1<>month_tq2 then %> <option value="<%=month_tq2%>"><%=month_tq2%></option> <% end if %> </select></font><font size="2">月<select size="1" name="date_tq"> <option value="<%=date_tq1%>" selected><%=date_tq1%></option> <option value="<%=date_tq2%>"><%=date_tq2%></option> </select>日

<p>

2004-08-31 下一工序的生产日期 <select size="1" name="month_tq"> <% year_tq1="2004" month_tq1="08" date_tq1="31"

date1_str=year_tq1&"-"&month_tq1&"-"&date_tq1 date1=cdate(date1_str) date2=dateadd("d",1,date1)

date_tq2=datepart("d",date2) month_tq2=datepart("m",date2) year_tq2=mid("yyyy",date2)

if len(date_tq2)=1 then date_tq2="0" & date_tq2 if len(month_tq2)=1 then month_tq2="0" & month_tq2 %> <option value="<%=month_tq1%>" selected><%=month_tq1%></option> <% if month_tq1<>month_tq2 then %> <option value="<%=month_tq2%>"><%=month_tq2%></option> <% end if %> </select></font><font size="2">月<select size="1" name="date_tq"> <option value="<%=date_tq1%>" selected><%=date_tq1%></option> <option value="<%=date_tq2%>"><%=date_tq2%></option> </select>日


四月天原创文学网 http://yc.4yt.net
2004-9-5 13:35
griefforyou
Rank: 12Rank: 12Rank: 12
等级:贵宾
威望:27
帖子:3338
积分:33882
注册:2004-4-15

这么简单的东西也要想两天?

四月天原创文学网 http://yc.4yt.net
2004-9-5 13:36
哈马拟
Rank: 3Rank: 3
等级:中级会员
帖子:270
积分:2800
注册:2004-7-15

如果不是你,可能2个两天都还想不出来……没听过看过用过datepart函数


2004-9-5 14:50
griefforyou
Rank: 12Rank: 12Rank: 12
等级:贵宾
威望:27
帖子:3338
积分:33882
注册:2004-4-15

不用datepart函数一样可以,用简单的字符串操作函数也可以呀,难道基本的分析能力也没有?

四月天原创文学网 http://yc.4yt.net
2004-9-5 16:55
关于我们 | 广告合作 | 编程中国 | 清除Cookies | Archiver | WAP | TOP

编程中国 版权所有,并保留所有权利。鲁ICP备08000592号
Powered by Discuz, Processed in 0.059880 second(s), 9 queries.
Copyright©2004-2008, BCCN.NET, All Rights Reserved