PHP mktime() function
Complete PHP Date Reference
Definition and Usage
The mktime() function returns the Unix timestamp for a date.
This timestamp contains the number of seconds between the Unix Epoch (January
1 1970 00:00:00 GMT) and the time specified.
Syntax
mktime(hour,minute,second,month,day,year,is_dst)
|
| Parameter |
Description |
| hour |
Optional. Specifies the hour |
| minute |
Optional. Specifies the minute |
| second |
Optional. Specifies the second |
| month |
Optional. Specifies the numerical month |
| day |
Optional. Specifies the day |
| year |
Optional. Specifies the year. The valid range for year is on some systems
between 1901 and 2038. However this limitation is overcome in PHP 5 |
| is_dst |
Optional. Set this parameter to 1 if the time is during daylight savings
time (DST), 0 if it is not, or -1 (the default) if it is unknown. If it's
unknown, PHP tries to find out itself (which may cause unexpected results).
Note: This parameter became deprecated in PHP 5. The new
timezone handling features should be used instead. |
Tips and Notes
Note: If the arguments are invalid, the function returns false (PHP
versions before 5.1 returns -1).
Example
The mktime() function is useful for doing date arithmetic and validation. It
will automatically calculate the correct value for out-of-range input:
<?php
echo(date("M-d-Y",mktime(0,0,0,12,36,2001))."<br />");
echo(date("M-d-Y",mktime(0,0,0,14,1,2001))."<br />");
echo(date("M-d-Y",mktime(0,0,0,1,1,2001))."<br />");
echo(date("M-d-Y",mktime(0,0,0,1,1,99))."<br />");
?>
|
The output of the code above would be:
Jan-05-2002
Feb-01-2002
Jan-01-2001
Jan-01-1999
|
Complete PHP Date Reference
 |
 |
 |
 |
|
The Ektron Intranet
lets you do everything you need to do on your corporate intranet and everything you want to do... all with just one application.
What can you do with the Ektron Intranet? |
 |
Navigate through content, documents, assets, colleagues and workgroups quickly and intuitively with enterprise search |
 |
Communicate with friends and colleagues with forums, message boards and corporate blogging using the new Social Networking Platform |

|
Utilize the extensive out-of-the box features or customize your site through Ektron CMS400.NET's open architecture |
 |
Promote collaboration in your organization through project workspaces where others can efficiently find information and work together |
 |
Author/edit content, manage navigation, menus, audit trails, workflow and approvals with the best in breed Content Management |
|
|
|
|
See why there are 20,000+ Ektron integrations worldwide.
|
|
 |
TAKE THE VIDEO TOUR |
 |
or download a FREE TRIAL today. |
|