I want to write in apex code below of the following to use in System.schedule Method. For Daily i can use this

String sch = '0 0 00 ? * MON-FRI';

How would I schedule a job with the following criteria?

  1. Weekly
  2. Every 15 days
  3. Monthly

1 Answer 1


The system.schedule argument to represent the Date and time of the job is a bit quirky at first, but once you get the hang of it, its really quite simple

To answer you immediate question

Weekly (Here it is set up to run every Saturday at 8am, but you can adjust which day of the week by changing the 6th element, which happens to be a 6 for Saturday)

String sch = '0 0 8 * * 6'

Every 15 Days (Here I have the job running on the 1st and 15th of each month)

String sch = '0 0 00 1,15 * ?'

Monthly (This runs at 8 am on the last day of the month)

string sch = '0 0 8 L * ?'

Take a look at the docs here


Have a similar question I answered here for a different time period, but same general concept

Apex cron job command to schedule an apex job to run every 4 hours daily

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .