PYTHON gmmktime

is this article helpful?
|
Python replacement for PHP's gmmktime [ edit | history ]
import calendar
result = calendar.timegm((year, month, day, hour, minute, second, wday, yday, is_dst))

PHP gmmktime

PHP original manual for gmmktime [ show | php.net ]

gmmktime

(PHP 4, PHP 5)

gmmktimeGet Unix timestamp for a GMT date

Description

int gmmktime ([ int $hour= gmdate("H") [, int $minute= gmdate("i") [, int $second= gmdate("s") [, int $month= gmdate("n") [, int $day= gmdate("j") [, int $year= gmdate("Y") [, int $is_dst= -1 ]]]]]]] )

Identical to mktime() except the passed parameters represents a GMT date. gmmktime() internally uses mktime() so only times valid in derived local time can be used.

Like mktime(), arguments may be left out in order from right to left, with any omitted arguments being set to the current corresponding GMT value.

Parameters

hour

The hour

minute

The minute

second

The second

month

The month

day

The day

year

The year

is_dst

Parameters always represent a GMT date so is_dst doesn't influence the result.

Return Values

Returns a integer Unix timestamp.

Changelog

Version Description
5.1.0 As of PHP 5.1.0, the is_dst parameter became deprecated. As a result, the new timezone handling features should be used instead.

Examples

Example #1 gmmktime() on Windows boundary

<?php
gmmktime
(000111970); // valid in GMT and west, invalid in east
?>

See Also

  • mktime() - Get Unix timestamp for a date
  • date() - Format a local time/date
  • time() - Return current Unix timestamp