Unlike most computers, the Pi lacks a real-time clock (or RTC). This means the Pi doesn’t know what time it is when powered on. If connected to a network, then the Pi could retrieve the current time from a time server (referred to as NTP). Another option is to connect an external real-time clock to the Pi via the I2C bus. I already had a DS1307 Real Time Clock breakout board kit from Adafruit.