# Certificate error caused by a wrong device clock (NET::ERR_CERT_DATE_INVALID, "your clock is ahead/behind")

**Code:** `clock` · **Category:** SSL / TLS · **Seen on:** Chrome, Windows, SSL

The site's certificate is valid, but the computer's date or time is wrong, so the browser thinks it is expired or not yet valid.

## Meaning

Set the date, time and timezone to automatic, sync NTP (`w32tm /resync`, `timedatectl`), and fix a dead CMOS battery or a VM with a paused clock. After a fix, restart the browser.

## Common causes

- Device date/time wrong
- Dead CMOS battery or reset BIOS clock
- VM/snapshot resumed with an old clock
- Timezone/NTP disabled
- Certificate truly expired (check separately)

## Quick fix

1. Enable automatic date/time sync
2. Run `w32tm /resync` or `chronyc makestep`
3. Compare with the real validity dates

## Detailed fix by platform

### Shell

1. 

```bash
timedatectl status
openssl s_client -connect example.com:443 </dev/null 2>/dev/null | openssl x509 -noout -dates
```


## How to diagnose

1. **Clock** — Correct?
2. **NTP** — Enabled?
3. **Cert dates** — Valid?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/ssl/err-cert-date-invalid-system-clock-wrong)
