是否有一个java类用于使用日期构建cron表达式? [英] Is there a java class for constructing a cron expression using a date?

查看:431
本文介绍了是否有一个java类用于使用日期构建cron表达式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要基于来自表单的用户输入来构建cron表达式。所以我有一个日期选择器和一个选择框来选择频率。我可以从这个足够容易地构建一个cron表达式,但感觉像我是重新发明的轮子。有没有合适的类来为我做这个?使用类似

I need to build a cron expression based on user input from a form. So I have a datepicker and a select box to choose the frequency. I can build a cron expression from this easily enough, but it feels like I am reinventing the wheel. Is there a suitable class to do this for me? Something with a method like

public String cron(String frequency, Calendar nextRunTime);


推荐答案

我认为quartz的Cron-为你,但你必须做一些编程,使其工作。 ( http://www.quartz-scheduler.org/docs/tutorials/crontrigger .html

I think the Cron-functionality in quartz could provide this for you, but you do have to do some programming to make it work. (http://www.quartz-scheduler.org/docs/tutorials/crontrigger.html)

这是如果我正确理解您的问题。

This is if I understand your question correctly.

这篇关于是否有一个java类用于使用日期构建cron表达式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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