| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 775 人关注过本帖
标题:我想做一个提示时间的软件,怎么处理时间比较
只看楼主 加入收藏
herogood
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2010-4-12
结帖率:0
收藏
已结贴  问题点数:20 回复次数:5 
我想做一个提示时间的软件,怎么处理时间比较
thisform.Label1.caption=TIME()
DO case
CASE TIME()>={8:10:00} and TIME()<={8:15:00}
     thisform.label2.Caption ="上午第一节课:8:20开始上课"
CASE TIME()>={9:05:00} and TIME()<={9:10:00}
     thisform.label2.Caption ="上午第二节课:9:15开始上课"
CASE TIME()>={10:10:00} and TIME()<={10:15:00}
     thisform.label2.Caption ="上午第三节课:10:20开始上课"
CASE TIME()>={11:05:00} and TIME()<={11:10:00}
     thisform.label2.Caption ="上午第四节课:11:15开始上课"
CASE TIME()>={13:20:00} and TIME()<={13:25:00}
     thisform.label2.Caption ="下午第一节课:1:30开始上课"
CASE TIME()>={14:15:00} and TIME()<={14:20:00}
     thisform.label2.Caption ="下午第二节课:2:25开始上课"
CASE TIME()>={15:10:00} and TIME()<={15:15:00}
     thisform.label2.Caption ="下午第三节课:3:20开始上课"
CASE TIME()>={16:05:00} and TIME()<={16:10:00}
     thisform.label2.Caption ="下午第四节课:4:15开始上课"
ENDCASE
程序代码:
thisform.Label1.caption=TIME()
DO case
CASE TIME()>={[color=#800000; font-weight: bold]8[/color]:[color=#800000; font-weight: bold]10[/color]:[color=#800000; font-weight: bold]00[/color]} and TIME()<={[color=#800000; font-weight: bold]8[/color]:[color=#800000; font-weight: bold]15[/color]:[color=#800000; font-weight: bold]00[/color]}
     thisform.label2.Caption ="上午第一节课:[color=#800000; font-weight: bold]8[/color]:20开始上课"
CASE TIME()>={[color=#800000; font-weight: bold]9[/color]:[color=#800000; font-weight: bold]05[/color]:[color=#800000; font-weight: bold]00[/color]} and TIME()<={[color=#800000; font-weight: bold]9[/color]:[color=#800000; font-weight: bold]10[/color]:[color=#800000; font-weight: bold]00[/color]}
     thisform.label2.Caption ="上午第二节课:[color=#800000; font-weight: bold]9[/color]:15开始上课"
CASE TIME()>={[color=#800000; font-weight: bold]10[/color]:[color=#800000; font-weight: bold]10[/color]:[color=#800000; font-weight: bold]00[/color]} and TIME()<={[color=#800000; font-weight: bold]10[/color]:[color=#800000; font-weight: bold]15[/color]:[color=#800000; font-weight: bold]00[/color]}
     thisform.label2.Caption ="上午第三节课:[color=#800000; font-weight: bold]10[/color]:20开始上课"
CASE TIME()>={[color=#800000; font-weight: bold]11[/color]:[color=#800000; font-weight: bold]05[/color]:[color=#800000; font-weight: bold]00[/color]} and TIME()<={[color=#800000; font-weight: bold]11[/color]:[color=#800000; font-weight: bold]10[/color]:[color=#800000; font-weight: bold]00[/color]}
     thisform.label2.Caption ="上午第四节课:[color=#800000; font-weight: bold]11[/color]:15开始上课"
CASE TIME()>={[color=#800000; font-weight: bold]13[/color]:[color=#800000; font-weight: bold]20[/color]:[color=#800000; font-weight: bold]00[/color]} and TIME()<={[color=#800000; font-weight: bold]13[/color]:[color=#800000; font-weight: bold]25[/color]:[color=#800000; font-weight: bold]00[/color]}
     thisform.label2.Caption ="下午第一节课:[color=#800000; font-weight: bold]1[/color]:30开始上课"
CASE TIME()>={[color=#800000; font-weight: bold]14[/color]:[color=#800000; font-weight: bold]15[/color]:[color=#800000; font-weight: bold]00[/color]} and TIME()<={[color=#800000; font-weight: bold]14[/color]:[color=#800000; font-weight: bold]20[/color]:[color=#800000; font-weight: bold]00[/color]}
     thisform.label2.Caption ="下午第二节课:[color=#800000; font-weight: bold]2[/color]:25开始上课"
CASE TIME()>={[color=#800000; font-weight: bold]15[/color]:[color=#800000; font-weight: bold]10[/color]:[color=#800000; font-weight: bold]00[/color]} and TIME()<={[color=#800000; font-weight: bold]15[/color]:[color=#800000; font-weight: bold]15[/color]:[color=#800000; font-weight: bold]00[/color]}
     thisform.label2.Caption ="下午第三节课:[color=#800000; font-weight: bold]3[/color]:20开始上课"
CASE TIME()>={[color=#800000; font-weight: bold]16[/color]:[color=#800000; font-weight: bold]05[/color]:[color=#800000; font-weight: bold]00[/color]} and TIME()<={[color=#800000; font-weight: bold]16[/color]:[color=#800000; font-weight: bold]10[/color]:[color=#800000; font-weight: bold]00[/color]}
     thisform.label2.Caption ="下午第四节课:[color=#800000; font-weight: bold]4[/color]:15开始上课"
ENDCASE
源代码和出错文件.rar (13.32 KB)

时间常量设置出问题
搜索更多相关主题的帖子: 时间 提示 软件 
2010-04-12 19:52
Tiger5392
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:88
帖 子:2775
专家分:2237
注 册:2006-5-17
收藏
得分:5 
Time()为字符型数据,{}为日期型常量,两者不可比较。Between(Time(),'08:10:00','08:15:00')可以

感言:学以致用。 博客:http://www./blog/user14/65009/index.shtml email:Tiger5392@
2010-04-12 20:38
qjbzjp
Rank: 13Rank: 13Rank: 13Rank: 13
来 自:尧的故乡
等 级:贵宾
威 望:48
帖 子:1914
专家分:4397
注 册:2007-3-14
收藏
得分:5 
CASE TIME()>="8:10:00" and TIME()<="8:15:00"
用2楼的方法更好。

相互学习,互相交流,共同提高。
2010-04-12 20:59
qingfameng
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:35
帖 子:964
专家分:3019
注 册:2010-2-6
收藏
得分:5 
.     .

[ 本帖最后由 qingfameng 于 2010-4-12 21:50 编辑 ]
2010-04-12 21:06
qingfameng
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:35
帖 子:964
专家分:3019
注 册:2010-2-6
收藏
得分:0 
回复 4楼 qingfameng
楼上说的对,要注意:"8:10:00" 要写成 "08:10:00"
2010-04-12 21:50
茵梦湖
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:贵宾
威 望:31
帖 子:545
专家分:2180
注 册:2009-4-25
收藏
得分:5 
既然都是距 正式开始上课时间的前10分钟-5分钟开始提醒, 那么用 for...endfor语句, 配合宏替换, 可使代码大为精简~~

2010-04-13 23:35
快速回复:我想做一个提示时间的软件,怎么处理时间比较
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.038771 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved