Here you can find the source of getMonthlyCronExpression(int minutes, int hours, int dayOfMonth)
Parameter | Description |
---|---|
minutes | a parameter |
hours | a parameter |
dayOfMonth | a parameter |
public static String getMonthlyCronExpression(int minutes, int hours, int dayOfMonth)
//package com.java2s; public class Main { /**/*w w w. j a va 2s .com*/ * Generates a cron pattern that will execute every month at the dayOfMonth at hour:minute * * @param minutes * @param hours * @param dayOfMonth * @return a cron pattern */ public static String getMonthlyCronExpression(int minutes, int hours, int dayOfMonth) { return getCronExpression("0", String.valueOf(minutes), String.valueOf(hours), String.valueOf(dayOfMonth), "*/1", null); } /** * Joins together each segment of a cron pattern into a complete cron pattern. * * @param seconds a valid cron segment * @param minutes a valid cron segment * @param hours a valid cron segment * @param days a valid cron segment * @param months a valid cron segment * @param weekday a valid cron segment (MON-SUN) * @return a cron pattern */ public static String getCronExpression(String seconds, String minutes, String hours, String days, String months, String weekday) { return String.join(" ", (seconds == null ? "*" : seconds), (minutes == null ? "*" : minutes), (hours == null ? "*" : hours), (days == null ? "*" : days), (months == null ? "*" : months), (weekday == null ? "*" : weekday)); } }