Home / PHP Tips Generated By ChatGPT / Getting the Current Time in a Specific Format in PHP Use date() to format the current date and time. For example, to display the current year. Source Code echo date("Y"); // Outputs the current year, e.g., "2023"