for example:

today 06/26/2018 at 00:00:00 unix the number was 1529971200

Question:

Is there a standard feature that would show the unix label of the new day? if not, maybe someone has a ready-made solution? please share!

I need this task to introduce statistics of unique visits. ip + date

    3 answers 3

    somehow so apparently?

    $ts = (new DateTime())->setTime(0,0)->getTimestamp() 

    or

     $ts = mktime(0,0,0); 
    • Practically, only your solution shows unix tag -3 GMT - verstala
    • my solution shows the label based on the time zone in the settings of php - teran
    • As far as I know, unix by default shows 0 GMT regardless of server settings. is not it? - verstala
    • Dak you description mktime read? - teran
    • the timestamp value in question says that the author is interested in when midnight in UTC¶ mktime () takes local time, which may differ from UTC (any time zone with a non-zero UTC shift). You can look for an analogue of the timegm function (inverse to gmtime ()). In python, the solution looks like: DT.datetime(2018,6,26, tzinfo=DT.timezone.utc).timestamp() - you can search for an analogue in php. - jfs

    It seems like strtotime(date("Ymd"))

      To get a Unix time corresponding to midnight in UTC for a specified date, you can use the gmmktime () function :

       echo gmmktime(0,0,0,6,26,2018); 

      Result :

       1529971200