date()
function
Formats a Unix timestamp as a date/time string. Uses current time when no timestamp is given.
Syntax
date(string $format, ?int $timestamp = null): string
Example
php
<?php
echo date('Y-m-d'); // 2024-01-15
echo date('d/m/Y'); // 15/01/2024
echo date('D, d M Y H:i:s'); // Mon, 15 Jan 2024 14:30:00
echo date('g:i A'); // 2:30 PM
echo date('U'); // Unix timestamp