Launch Workspace
Standard Cron · 5 fields · @daily · @midnight

Cron Every Day at Midnight — 0 0 * * *

Fires once per day at 00:00 (midnight). The standard schedule for backups, log rotation, and nightly batch jobs.

Dialect:
5 fields
Plain EnglishDaily

“Every day at 12:00 AM”

Runs every day at 12:00 am. Evaluated according to STANDARD cron specifications.

Popular Presets:

Why midnight is the most popular daily cron time

Midnight (00:00) is the conventional default for nightly batch jobs because it represents the natural boundary between calendar days. Database backup tools (pg_dump, mysqldump, restic), log archival services (logrotate), and analytics aggregation pipelines typically default to midnight so that daily datasets are complete before business hours begin.

However, many large organisations stagger their midnight jobs — running backups at 00:05, log rotation at 00:10, and report generation at 00:30 — to avoid resource contention on shared servers. If your server runs many midnight jobs, consider offsetting some to 01:00 or 02:00.

Timezone pinning for midnight schedules

Without explicit timezone configuration, "midnight" means midnight in the system timezone. For global applications, this may not align with user expectations. Always specify timezone in your scheduler: in Kubernetes via spec.timeZone, in Spring Boot via zone = "TZ_ID", and verify your Linux cron daemon timezone via timedatectl or /etc/timezone.

Platform Examples for 0 0 * * *

Ready-to-use snippets for all major platforms and schedulers.

Linux / Crontab5-field POSIX cron
# /etc/cron.d/my-schedule
MAILTO="admin@example.com"
SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# Runs every day at midnight (00:00)
0 0 * * * www-data /usr/local/bin/my-script.sh >> /var/log/my-script.log 2>&1
Kubernetesbatch/v1 CronJob manifest
apiVersion: batch/v1
kind: CronJob
metadata:
  name: my-scheduled-job
  labels:
    app: my-scheduled-job
spec:
  schedule: "0 0 * * *"
  timeZone: "UTC"          # requires Kubernetes v1.27+
  concurrencyPolicy: Forbid
  successfulJobsHistoryLimit: 3
  failedJobsHistoryLimit: 1
  jobTemplate:
    spec:
      template:
        spec:
          containers:
          - name: job
            image: alpine:latest
            command:
            - /bin/sh
            - -c
            - echo "Job executed at $(date)"
          restartPolicy: OnFailure
GitHub Actionsworkflow schedule trigger (UTC only)
name: Scheduled Workflow

on:
  schedule:
    # Runs every day at midnight (00:00) — evaluated strictly in UTC
    - cron: "0 0 * * *"
  workflow_dispatch: # allow manual trigger

jobs:
  run-job:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Run task
        run: echo "Workflow triggered at $(date)"
Spring Boot@Scheduled — 6-field cron with seconds
@Component
public class ScheduledTask {

    private static final Logger log = LoggerFactory.getLogger(ScheduledTask.class);

    // Runs every day at midnight (00:00)
    // Spring uses 6-field cron: sec min hr dom mon dow
    @Scheduled(cron = "0 0 0 * * *", zone = "UTC")
    public void runTask() {
        log.info("Scheduled job started at: {}", LocalDateTime.now());
        // your business logic here
    }
}
AWS EventBridge6-field cron with year field
# AWS EventBridge Rule (CloudFormation)
Resources:
  ScheduledRule:
    Type: AWS::Events::Rule
    Properties:
      Name: my-scheduled-rule
      ScheduleExpression: "cron(0 0 * * ? *)"
      State: ENABLED
      Targets:
        - Arn: !GetAtt MyLambdaFunction.Arn
          Id: LambdaTarget

Common Variations

Related expressions for similar scheduling needs.

ExpressionDescription
0 0 * * *Every day at midnight (00:00)
0 1 * * *Every day at 1:00 AM (offset from midnight to avoid peak load)
0 2 * * *Every day at 2:00 AM (common for database backups)
0 0 * * 1-5Every weekday at midnight
0 0 1 * *First day of every month at midnight
0 0 * * 0Every Sunday at midnight (weekly job)

Frequently Asked Questions

Everything you need to know about Cron expressions, syntax rules, and platform nuances.

What is the cron expression for every day at midnight?

The cron expression "0 0 * * *" runs every day at 12:00 AM (midnight, or 00:00 in 24-hour time). This is the most common daily schedule for database backups, log rotation, and nightly batch processing.

Is "0 0 * * *" the same as "@midnight" or "@daily"?

Yes. "@daily" and "@midnight" are non-standard cron macros supported by GNU cron (Vixie cron) and are exactly equivalent to "0 0 * * *". However, these @ macros are NOT supported in Kubernetes CronJobs, GitHub Actions schedules, AWS EventBridge, or Spring Boot — use the explicit 5-field form for portability.

What timezone does "0 0 * * *" use?

By default, cron uses the server's system timezone. Most production Linux servers run in UTC. To verify: run "timedatectl" or "date" on the server. In Kubernetes (v1.27+), set spec.timeZone: "America/New_York". In Spring Boot, use @Scheduled(cron = "0 0 0 * * *", zone = "America/New_York"). Always pin the timezone explicitly for production daily jobs.

Will "0 0 * * *" be affected by daylight saving time?

In UTC: no effect, DST does not apply. In local timezones: since midnight is not in the 2:00–3:00 AM DST transition window, the midnight schedule is practically unaffected. The job still runs at 00:00 local time on every day of the year, including DST change days. The wall clock simply counts up from midnight as usual.

What is the Spring Boot @Scheduled cron for midnight daily?

@Scheduled(cron = "0 0 0 * * *", zone = "UTC") — in Spring's 6-field format: seconds=0, minutes=0, hours=0, day=*, month=*, weekday=*. Without the zone parameter, Spring uses the JVM default timezone, which varies per deployment environment.