Skip to main content
Gainsight Inc.

Cron Expression for Advanced Scheduler in Data Designer

Gainsight NXT



This article explains admins on how to use Cron Expressions in scheduling data space refreshes. Gainsight recommends that you refer to the Schedule Data Space Refreshes article listed in the Additional Resources section below, and then proceed with this article

Advanced Scheduler in Data Designer uses Cron Expressions to schedule data space refreshes. This enables users to refresh the data space more frequently, as compared to the existing (Basic) scheduler. Data Spaces can be run more than once per day. Some of the advanced use cases include running the data spaces as frequently as every two hours and every 1st and 15th of a month.

Note: The minimum time period between data space runs is two hours.


Format of Cron Expression

To provide flexibility in refreshing data spaces, Gainsight allows you to input a  cron expression. This is a string comprising 6 or 7 fields that are separated by spaces and defines the details of a schedule. Each field represents a sub-expression and allows only specific values. These values combined with special characters define the schedule. Refer to the following table for allowed values and special characters in Cron Expression:

Field Order

Field Name


Allowed Values

Allowed Special Characters





, - * /





, - * /





, - * /


Day of Month YES


, - * ? / L W


Month YES

1-12 or JAN-DEC

, - * /


Day of week YES

1-7 or SUN-SAT

, - * ? / L #


Year NO

Empty, 1970-2099

, - * /

Special Characters

The following is the list of special characters used in Cron Expressions:

  • * (“all values”) - used to select all values within a field. For example, “” in the minute field means *“every minute”.

  • ? (“no specific value”) - useful when you need to specify something in one of the two fields in which the character is allowed, but not the other. For example, to fire a trigger on a particular day of the month (say, the 10th), but any day of the week, use  “10” in the day-of-month field, and “?” in the day-of-week field. See the Examples chapter for clarification.

  • - used to specify ranges. For example, “10-12” in the hour field means “the hours 10, 11 and 12”.

  • , used to specify additional values. For example, “MON,WED,FRI” in the day-of-week field means “the days Monday, Wednesday, and Friday”.

  • / used to specify increments. For example, “0/15” in the seconds field means “the seconds 0, 15, 30, and 45”. And “5/15” in the seconds field means “the seconds 5, 20, 35, and 50”. You can also specify ‘/’ after the ‘’ character - in this case ‘’ is equivalent to having ‘0’ before the ‘/’. ‘1/3’ in the day-of-month field means “fire every 3 days starting on the first day of the month”.

  • L (“last”) - has different meanings in each of the two fields in which it is allowed. For example, the value “L” in the day-of-month field means “the last day of the month” - day 31 for January, day 28 for February in non-leap years. If used in the day-of-week field by itself, it simply means “7” or “SAT”. But, if used in the day-of-week field after another value, it means “the last xxx day of the month” - for example “6L” means “the last friday of the month”. You can also specify an offset from the last day of the month, such as “L-3” which would mean the third-to-last day of the calendar month.

Note: When using the ‘L’ option, it is important not to specify lists, or ranges of values, as you’ll get confusing/unexpected results.

  • W (“weekday”) - used to specify the weekday (Monday-Friday) nearest the given day. For example, to specify “15W” as the value for the day-of-month field, the meaning is: “the nearest weekday to the 15th of the month”. So, if the 15th is a Saturday, the trigger is fired on Friday the 14th. If the 15th is a Sunday, the trigger is fired on Monday the 16th. If the 15th is a Tuesday, then it is fired on Tuesday the 15th. However, if you specify “1W” as the value for day-of-month, and the 1st is a Saturday, the trigger is fired on Monday the 3rd, as it will not ‘jump’ over the boundary of a month’s days. The ‘W’ character can only be specified when the day-of-month is a single day, not a range or list of days.

Note: The 'L' and 'W' characters can also be combined in the day-of-month field to yield 'LW', which translates to *"last weekday of the month"*.

  • # - used to specify “the nth” XXX day of the month. For example, the value of “6#3” in the day-of-week field means “the third Friday of the month” (day 6 = Friday and “#3” = the 3rd one in the month). Other examples: “2#1” = the first Monday of the month and “4#5” = the fifth Wednesday of the month. Note that if you specify “#5” and there is not 5 of the given day-of-week in the month, then no firing occurs that month.

Note: The legal characters and the names of months and days of the week are not case sensitive. MON is the same as mon.


Consider the following schedules and the respective Cron Expressions:

Rule run schedule

Cron Expression

Every 4 hours

0 0 */4 ? * *

Every 1st and 15th of a month

0 0 0 1,15 * ?

Once in every 90 days at 8:15 AM

0 15 8 1 1/3 ? *

Last day of every month at noon

0 0 12 L * ?

Every first Monday of the month at noon

0 0 12 ? 1/1 MON#1 *

Consider the data space Run schedule for 'Once in every 90 days at 8:15 AM'. As the maximum no. of days in a month is 31, at order 4 -- 90 days cannot be represented. Instead at order 5 using 1/3 runs the data space once in three months and at order 4 data space can run on 1st of the month, in every three months. This approximately runs the data space for 90 days. The next data space run schedules are: 

  1. Sunday, October 1, 2017 8:15 AM

  2. Monday, January 1, 2018 8:15 AM

  3. Sunday, April 1, 2018 8:15 AM

  4. Sunday, July 1, 2018 8:15 AM

  5. Monday, October 1, 2018 8:15 AM

Tools to generate Cron Expression

Visit the following sites to generate a cron expression as required:

Additional Resources

Note: If you have feedback or questions about the feature explained in this article, please share them on
  • Was this article helpful?