Menu

Add Topic

Forum

waiting answer July 28, 2021

PHP | gmdate() Function

Answers
June 07, 2021

gmdate() is an inbuilt function in PHP and it returns the time in Greenwich Mean Time(GMT). It is used to format a GMT/UTC time.

To display the current date and time

     <?php
        echo gmdate('Y-m-d H:i:s'); //showing current gmt
     ?>

To display date - World Wide Web Consortium 

     <?php
        echo gmdate(DATE_W3C) //showing date - World Wide Web Consortium
     ?>

To display the date as ISO Format

     <?php
        echo gmdate(DATE_ISO8601);
     ?> 

0 0
June 07, 2021

gmdate function is used to format GMT/UTC date/time.

Version

           PHP 4 and above

Syntax

           gmdate(format, timestamp)

  • $format is a required parameter. It specifies the format of outputted date string
  • $timestamp is an optional parameter. It specifies integer Unix timestamp or the local time.

The return value of this function is a formatted date string and FALSE or E_WARNING on failure.

0 0

Please Login to Post the answer

Leave an Answer