PHP gmmktime() Function

In this chapter you will learn:

  1. Definition for PHP gmmktime() Function
  2. Syntax for PHP gmmktime() Function
  3. Parameter for PHP gmmktime() Function
  4. Return value from PHP gmmktime() Function
  5. Note for PHP gmmktime() Function
  6. Example - Return the Unix timestamp for a GMT date. Then use it to find the day of that date

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.

Next chapter...

What you will learn in the next chapter:

  1. Definition for PHP gmstrftime() Function
  2. Syntax for PHP gmstrftime() Function
  3. Parameter for PHP gmstrftime() Function
  4. Format for PHP gmstrftime() Function
  5. Return value for PHP gmstrftime() Function
  6. Example - Format GMT/UTC date and time according to locale settings
Home » PHP Tutorial » PHP Date Functions
PHP checkdate() Function
PHP date() Function
PHP date_add() Function
PHP date_create() Function
PHP date_create_from_format() Function
PHP date_date_set() Function
PHP date_default_timezone_get() Function
PHP date_default_timezone_set() Function
PHP date_diff() Function
PHP date_format() Function
PHP date_get_last_errors() Function
PHP date_interval_format() Function
PHP date_isodate_set() Function
PHP date_modify() Function
PHP date_offset_get() Function
PHP date_parse() Function
PHP date_parse_from_format() Function
PHP date_sub() Function
PHP date_sun_info() Function
PHP date_sunrise() Function
PHP date_sunset() Function
PHP date_time_set() Function
PHP date_timestamp_get() Function
PHP date_timestamp_set() Function
PHP date_timezone_get() Function
PHP date_timezone_set() Function
PHP getdate() Function
PHP gettimeofday() Function
PHP gmdate() Function
PHP gmmktime() Function
PHP gmstrftime() Function
PHP idate() Function
PHP localtime() Function
PHP microtime() Function
PHP mktime() Function
PHP strftime() Function
PHP strptime() Function
PHP strtotime() Function
PHP time() Function
PHP Timezones Constant
PHP timezone_abbreviations_list() Function
PHP timezone_identifiers_list() Function
PHP timezone_location_get() Function
PHP timezone_name_from_abbr() Function
PHP timezone_name_get() Function
PHP timezone_offset_get() Function
PHP timezone_open() Function
PHP timezone_version_get() Function