Creating Timestamps from Date and Time Values In PHP

The mktime() function returns a timestamp based on up to six time/date arguments, as follows:

  • Hour (0 – 23)
  • Minute (0 – 59)
  • Second (0 – 59)
  • Month (1 – 12)
  • Day of the month (1 – 31)
  • Year (1901 – 2038)

Example

To displays the timestamp corresponding to 2:32:12 pm on January 6, 1972:

echo mktime( 14, 32, 12, 1, 6, 1972 );

Scroll to Top