functions-online

mktime

description

Returns the Unix timestamp corresponding to the arguments given. This timestamp is a long integer containing the number of seconds between the Unix Epoch (January 1 1970 00:00:00 GMT) and the time specified.

Arguments may be left out in order from right to left; any arguments thus omitted will be set to the current value according to the local date and time.

declaration of mktime

int mktime ( [int $hour ] [, int $minute ] [, int $second ] [, int $month ] [, int $day ] [, int $year ] [, int $is_dst ] )

test mktime online






















share mktime

comments for mktime

On 16. Aug 2013 12:47 Kaustav Banerjee wrote:

Hey, @rajesh. you can do that using the PHP date() function. e.g. echo date("M d, Y", mktime(0, 0, 0, 16, 8, 2013)); // will print Aug 16, 2013

On 16. Jul 2013 07:35 Vincy wrote:

@any arguments thus omitted will be set to the current value according to the local date and time. How can we omit any arguments? If I call like mktime('',30,30,7,7,1984) returns Warning: mktime() expects parameter 1 to be long else I call by omitting the first argument, like mktime(30,30,7,7,1984) then the arguments are set to hour,minute,second,month,day, respectively, and for year it takes current value which is added with the value carry over from day and month argument and returns, 1544074207 After I invoke date() for this timestamp computed, it returns 06-12-2018 06:30:07 Is there any possibility of taking current value for a particular argument omitted?

On 24. Mar 2012 11:27 butzi wrote:

@santhosh: use strtotime for this.

more comments for mktime

There are some more comments for mktime(). To see them all click here.

+

Leave your comment