spacer.png, 0 kB
spacer.png, 0 kB
Home arrow PHP arrow mktime() and time() functions
mktime() and time() functions PDF Print E-mail
 
Mktime() returns an integer value (long) corresponding to the Unix timestamp for the arguments given. This timestamp is a value containing the number of seconds between the Unix Epoch (January 1 1970 00:00:00 GMT) and the time specified and is useful for date operations and comparations.
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.
int mktime (int $hour, int $minute, int $second, int $month, int $day, int $year [, int $is_dst ])
is_dst can be set to 1 if the time is during daylight savings time (DST), 0 if it is not, or -1 (the default) if it is unknown whether the time is within daylight savings time or not. If it's unknown, PHP tries to figure it out itself. This can cause unexpected (but not incorrect) results.
 
Mktime can also calculate the parameter if this is outside the interval (for example a value of 35 for a month) or negative. The example below returns "Jan-01-1998" string in the four cases. 
echo date ("d-M-Y", mktime (0,0,0,12,32,1997));
echo date ("d-M-Y", mktime (0,0,0,13,1,1997));
echo date ("d-M-Y", mktime (0,0,0,1,1,1998));
echo date ("d-M-Y", mktime (0,0,0,1,1,98));

Time() function returns the current time measured in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT).
int time (void)
Last Updated ( marted́, 04 dicembre 2007 )
 
< Prev   Next >
spacer.png, 0 kB
spacer.png, 0 kB
spacer.png, 0 kB