时间表符号(时间范围) [英] Schedule notation (time ranges)

查看:222
本文介绍了时间表符号(时间范围)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些代码,需要根据时间表做事情:例如在营业时间里,X,过了几个小时之后,我们的客户将定义时间表,所以我需要一个可以由人写的符号,由我的程序解析。我在想这样的事情:

  12/25:0730-1730 Do Y 
[Mo-Fr] :0730-1730 Do X
[Mo-Tu]:1730-0730 Do Y
Fr:1730-Mo:0730 Do Y

肯定会有每周变化。年度变化(假期)似乎很可能。我想要一个高效灵活的符号。



我还需要java代码来解析时间段,并告诉我给定日期时间的范围。



我已经搜索到网页,没有发现任何内容。最近的是CRON符号,这不是我需要的。



任何一个现有的符号定义和实现知道?



谢谢,

解决方案

对于Java Joda时间 (Scala包装器 scala-time )是一个强大的时间计算库。您可以查看 google-rfc-2445 ,这样做就像你要求(?)。



如果您正在寻找Java调度程序 http://www.quartz-scheduler.org/ 是一个很好的选择。


I have some code which needs to do things based on a schedule: e.g. during business hours do X, after hours do Y. The schedule will be defined by our customer's so I need a notation which can be written by people and parsed by my program. I'm thinking of something like:

12/25:0730-1730 Do Y
[Mo-Fr]:0730-1730 Do X
[Mo-Tu]:1730-0730 Do Y
Fr:1730-Mo:0730 Do Y

There will definitely be weekly variation. Yearly variation (holidays) seems likely. I would like a notation that is efficient and flexible.

I also need java code which will parse the time ranges and tell me which range a given date time is in.

I've searched the web and found nothing. Closest is CRON notation, which is not quite what I need.

Any one know of an existing notation definition and implementation?

Thanks,

解决方案

For Java Joda time (Scala wrapper scala-time) is a powerful library for time calculations. You could look at the google-rfc-2445 which does something like what you are asking for (?).

If you are looking for a Java scheduler http://www.quartz-scheduler.org/ is a good option.

这篇关于时间表符号(时间范围)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆