gmmktime (hour, minute, second, month, day, year)
Output is timestamp$d1=mktime(23,36,55,12,19,2016);
$d2=gmmktime(23,36,55,12,19,2016);
$d3=$d2-$d1;
echo " mktime(): $d1 <br> gmmktime() : $d2 <br> Difference : $d3";
Output is heremktime(): 1482170815
gmmktime() : 1482190615
Difference : 19800
Function | Description |
---|---|
strtotime() | Text string of data to timestamp |
gettimestamp() | Getting Timestamp from date object |
$utc_time = gmmktime(12, 30, 0, 7, 10, 2023);
echo date("Y-m-d H:i:s", $utc_time); // Output: UTC date and time
$local_time = mktime(12, 30, 0, 7, 10, 2023);
$utc_time = gmmktime(12, 30, 0, 7, 10, 2023);
echo date("Y-m-d H:i:s", $local_time); // Local time
echo '
';
echo date("Y-m-d H:i:s", $utc_time); // UTC time
Output
2023-07-10 12:30:00
2023-07-10 14:30:00
Author
🎥 Join me live on YouTubePassionate about coding and teaching, I publish practical tutorials on PHP, Python, JavaScript, SQL, and web development. My goal is to make learning simple, engaging, and project‑oriented with real examples and source code.