PHP: mktime() function


The mktime() function returns the Unix timestamp for a date.


(PHP 4 and above)


mktime(hour, minute, second, month, day, year, is_dst)


Name Description Required/
hour Numeric representation of hours Optional Integer
minute Numeric representation of minute Optional Integer
second Numeric representation of second Optional Integer
month Numeric representation of month Optional Integer
day Numeric representation of day Optional Integer
year Numeric representation of year Optional Integer
is_dst Whether Daylight Saving Time is active (values 1 or 0 ). In PHP 5.1.0, this parameter became deprecated. As a result, the new timezone handling features should be used instead. Optional Integer

Return value:

The Unix timestamp corresponding to the parameters given. If the parameters are invalid, the function returns FALSE.

Value Type: Integer.


echo(date("M-d-Y",mktime(0,0,0,2,12,98))."<br />");
echo(date("M-d-Y",mktime(0,0,0,17,4,2005))."<br />");
echo(date("M-d-Y",mktime(0,0,0,1,36,2000))."<br />");
echo(date("M-d-Y",mktime(24,0,0,1,1,99))."<br />");

Sample Output :


View the example in the browser

See also

PHP Function Reference

Previous: microtime
Next: strftime

PHP: Tips of the Day

Convert HTML + CSS to PDF

Important: Please note that this answer was written in 2009 and it might not be the most cost-effective solution today in 2019. Online alternatives are better today at this than they were back then.

Here are some online services that you can use:

  • PDFShift
  • Restpack
  • PDF Layer
  • DocRaptor
  • HTML to PDF Rocket

Have a look at PrinceXML.

It's definitely the best HTML/CSS to PDF converter out there, although it's not free (But hey, your programming might not be free either, so if it saves you 10 hours of work, you're home free (since youalso need to take into account that the alternative solutions will require you to setup a dedicated server with the right software).

Ref : https://bit.ly/384yytr