Cron Expression for the 1st and 15th of Each Month
Run a cron job on the 1st and 15th of every month at midnight using 0 0 1,15 * *. A common semi-monthly schedule for payroll and billing.
Expression
0 0 1,15 * * At 00:00 on the 1st and 15th of every month
Use Cases
- • Processing semi-monthly payroll
- • Generating bi-monthly billing invoices
- • Running twice-monthly data audits
- • Sending semi-monthly newsletter digests
Code Examples
Crontab
# At 00:00 on the 1st and 15th of every month
0 0 1,15 * * /path/to/your/script.sh GitHub Actions
name: Scheduled Job
on:
schedule:
- cron: '0 0 1,15 * *'
jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: echo "Running First and Fifteenth of Each Month" systemd Timer
[Unit]
Description=First and Fifteenth of Each Month timer
[Timer]
OnCalendar=*-*-* *:*:00
Persistent=true
[Install]
WantedBy=timers.target node-cron (Node.js)
import cron from 'node-cron'
// At 00:00 on the 1st and 15th of every month
cron.schedule('0 0 1,15 * *', () => {
console.log('Running First and Fifteenth of Each Month')
}) Spring (@Scheduled, Java)
// At 00:00 on the 1st and 15th of every month
@Scheduled(cron = "0 0 0 1,15 * *")
public void run() {
// your task
} Spring cron has 6 fields (a leading seconds field), so a 0 is prepended to the standard 5-field expression.
Tips
- ✓ Commonly used for payroll processing (1st and 15th)
- ✓ Runs exactly 24 times per year
- ✓ Both dates exist in every month, unlike day 31
- ✓ Adjust to business hours: 0 9 1,15 * * for 9 AM
Frequently Asked Questions
How do I run on the 1st and 15th?
Use comma-separated values in the day-of-month field: 0 0 1,15 * * runs at midnight on the 1st and 15th of every month.
Is this the same as twice a month?
Yes, this runs exactly twice per month. It is the most common semi-monthly cron schedule, often used for payroll.