PHP Tutorial - PHP gmmktime() Function






Definition

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

Syntax

PHP gmmktime() Function has the following syntax. gmmktime(hour,minute,second,month,day,year,is_dst);

Parameter

ParameterIs RequiredDescription
hourOptional.hour value
minuteOptional.minute value
secondOptional.second value
monthOptional.month value
dayOptional.day value
yearOptional.year value




Return

PHP gmmktime() Function returns an integer Unix timestamp.

Note

This function is identical to mktime() except the passed parameters represents a GMT date.

Example

Return the Unix timestamp for a GMT date. Then use it to find the day of that date:


<?php
echo date("l", gmmktime(0,0,0,10,3,2013));
?>

The code above generates the following result.