w3resource

PHP: gmmktime() function

Description

The gmmktime() function is used to create a Unix timestamp for a GMT date.

Version:

(PHP 4 and above)

Syntax:

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

Parameters:

Name Description Required/ Optional Type
hour Specifies the hour Optional integer
minute Specifies the minute Optional integer
second Specifies the second Optional integer
month Specifies the month Optional integer
day Specifies the day Optional integer
year Specifies the year Optional integer
is_dst Since other parameters represent a GMT date so is_dst doesn't effect the result. Optional integer

Return value:

Unix timestamp.

Value Type: Integer.

Example:

<?php
$birthday = gmmktime(0,0,0,10,3,1975);
echo $birthday . "<br />";
echo(date("M-d-Y",$birthday));
echo "<br />".'---------------------';
echo "<br />".'Another format'."<br />";
echo(date("D-M-d-Y",$birthday));
?> 

Output:

181526400
Oct-03-1975
---------------------
Another format
Fri-Oct-03-1975

View the example in the browser

See also

PHP Function Reference

Previous: gmdate
Next: gmstrftime



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://www.w3resource.com/php/function-reference/gmmktime.php