Change language

PHP Gmdate () function

Syntax:
string gmdate ($format, $timestamp) 
Parameters:The gmdate() function takes two parameter as above and described below:
  • $format:is a required parameter that specifies the format of the returned date and time.
  • $timestamp:Timestamp - optional parameter, if not included, current date and time will be used.
Return Value:This function returns a formatted date string on success and FALSE on failure and E_WARNING.The programs below illustrate the gmdate() function.Program 1:
// PHP program to illustrate the gmdate function 
// display date 25 June 2018 23:21:50 echo gmdate ( "M d YH: i: s" , mktime (23, 21, 50, 6, 25, 2018)). "" ;  
// display the date of the World Wide Web Consortium
// 2018-06-25T23: 21: 50 + 00: 00 echo gmdate (DATE_W3C, mktime (23, 21, 50, 6, 25, 2018)). "" ;  
// display date in ISO-8601 format echo gmdate (DATE_ISO8601, mktime (23, 21, 50, 6, 25, 2018)). "" ;  
?>
Exit:
Jun 25 2018 23:21:50 2018-06-25T23: 21: 50 + 00: 00 2018-06-25T23: 21: 50 + 0000 
Program 2:By passing one parameter, it will return the current local time (time()).
/ / PHP program to illustrate the gmdate function 
// display the current date and time
// 28 June 2018 14:52:50 echo gmdate ( "M d YH: i: s" ). "" ;  
// display the date of the World Wide Web Consortium echo gmdate (DATE_W3C). "" ;  
// display date in ISO-8601 format echo gmdate (DATE_ISO8601). "" ;  
?>
Exit:
Jun 29 2018 06:32:34 2018-06-29T06: 32: 34 + 00: 00 2018-06-29T06: 32: 34 + 0000 
Similar article:
  • PHP | Date and time
  • PHP | time function()
Link: http://php.net/manual/en/function.gmdate.php

Shop

Gifts for programmers

Best laptop for Excel

$
Gifts for programmers

Best laptop for Solidworks

$399+
Gifts for programmers

Best laptop for Roblox

$399+
Gifts for programmers

Best laptop for development

$499+
Gifts for programmers

Best laptop for Cricut Maker

$299+
Gifts for programmers

Best laptop for hacking

$890
Gifts for programmers

Best laptop for Machine Learning

$699+
Gifts for programmers

Raspberry Pi robot kit

$150

Latest questions

PythonStackOverflow

Common xlabel/ylabel for matplotlib subplots

1947 answers

PythonStackOverflow

Check if one list is a subset of another in Python

1173 answers

PythonStackOverflow

How to specify multiple return types using type-hints

1002 answers

PythonStackOverflow

Printing words vertically in Python

909 answers

PythonStackOverflow

Python Extract words from a given string

798 answers

PythonStackOverflow

Why do I get "Pickle - EOFError: Ran out of input" reading an empty file?

606 answers

PythonStackOverflow

Python os.path.join () method

384 answers

PythonStackOverflow

Flake8: Ignore specific warning for entire file

360 answers


Wiki

Python | How to copy data from one Excel sheet to another

Common xlabel/ylabel for matplotlib subplots

Check if one list is a subset of another in Python

How to specify multiple return types using type-hints

Printing words vertically in Python

Python Extract words from a given string

Cyclic redundancy check in Python

Finding mean, median, mode in Python without libraries

Python add suffix / add prefix to strings in a list

Why do I get "Pickle - EOFError: Ran out of input" reading an empty file?

Python - Move item to the end of the list

Python - Print list vertically