# PHP Get the Current Year with the date() Function

> Use the PHP date() function with the Y format specifier to return the current four-digit year from the server, with a link to the full date and time guide

**URL:** https://sentry.io/answers/how-do-i-use-php-to-get-the-current-year/

---

## The Problem

How do I use PHP to get the current year?

## The Solution

You can use the [`date()` function](https://sentry.io/answers/how-do-i-get-the-current-date-and-time-in-php/) with the `Y` format specifier to get the current year of the server. For example: 

```php
echo date('Y');
```

Output:

```
2023
```

---

*Source: [sentry.io/answers/how-do-i-use-php-to-get-the-current-year/](https://sentry.io/answers/how-do-i-use-php-to-get-the-current-year/)*
