PHP gmmktime

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

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 :

  1. $birthday = gmmktime(0,0,0,10,3,1975);  

  2. echo $birthday . "
    ";  

  3. echo(date("M-d-Y",$birthday));  

  4. echo "
    ".'---------------------';  

  5. echo "
    ".'Another format'."
    ";  

  6. echo(date("D-M-d-Y",$birthday));  

  7. ?>   

Output :

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