w3resource

PHP: mktime() function

Description

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

Version:

(PHP 4 and above)

Syntax:

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

Parameter:

Name Description Required/
Optional
Type
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.

Example:

<?php
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 :

Feb-12-1998
May-04-2006
Feb-05-2000
Jan-02-1999

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
  • HTMLPDFAPI
  • 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