Menu

Add Topic

programming

waiting answer July 28, 2021

How to get current year using PHP

Answers
June 15, 2021

You can the PHP function date() to get the current year.

Syntax

           date( format, timestamp);

the format is a required parameter. It specifies the format of returned date and time. the timestamp is an optional parameter.

     <?php 
        $year = date('Y');
        echo $year; 
     ?>

OUTPUT

            2021

0 0

Please Login to Post the answer

Leave an Answer