Curriculum
Course: PHP Basic
Login

Curriculum

PHP Basic

PHP Install

0/1

PHP Casting

0/1

PHP Constants

0/1

PHP Magic Constants

0/1

PHP Operators

0/1

PHP Reference

0/276
Text lesson

gmmktime()

Example

Return the Unix timestamp for a GMT date, and then use it to determine the day of that date.

<?php
// Prints: October 3, 1975 was on a Friday
echo “Oct 3, 1975 was on a “.date(“l”, gmmktime(0,0,0,10,3,1975));
?>

Definition and Usage

The gmmktime() function returns the Unix timestamp for a GMT date.

 

Tip: This function operates the same as mktime(), but the parameters represent a GMT date.

Syntax

gmmktime(hour, minute, second, month, day, year, is_dst)

Parameter Values

Parameter

Description

hour

Optional. Indicates the hour.

minute

Optional. Indicates the minute.

second

Optional. Indicates the second.

month

Optional. Indicates the month.

day

Optional. Indicates the day.

year

Optional. Indicates the year.

is_dst

Optional. Parameters always represent a GMT date, so is_dst does not affect the result. Note: This parameter was removed in PHP 7.0; use the new timezone handling features instead.

Technical Details

Return Value:

Returns an integer Unix timestamp.

PHP Version:

4+

PHP Changelog:

PHP 5.1: The is_dst parameter was deprecated.
PHP 7.0: The
is_dst parameter was removed.