How can i know timestamp
of today at 18.00 UTC with php ?
(obviously i don't know what day is today).
So i tried this:
$timestamp_now= time();
$today= gmdate("d-m-Y", $timestamp_now); //output for today 20-02-2020
$output= strtotime($today." 18:00"); //i tried to get timestamp for (utc data)
For 20-02-2020 18.00 UTC the timestamp should be:
Epoch timestamp: 1582221600
But with my code the output is about 20-02-2020 23.00 (i don't know what time zone):
timestamp: 1582239600
What is the error ?
EDIT i solved my question:
$timestamp_now= time();
$oggi_giorno= gmdate("d", $timestamp_now); //get utc day for today
$oggi_mese= gmdate("m", $timestamp_now); //get utc month for today
$oggi_anno= gmdate("Y", $timestamp_now); //get utc year for today
$output= gmmktime(18, 0, 0, $oggi_mese, $oggi_giorno, $oggi_anno);
//THE OUTPUT IS: 1582221600
The output is correct because is about 20-02-2020 18.00 UTC so to get timestamp for UTC Date must to use gmmktime
!
Thanks.