phpmicrotime

PHP - Convert specific hour into microtime


I need to know how to convert 07:00pm of the current date in microtime. Sorry if this is a silly question but I cannot find the answer anywhere


Solution

  • php mktime()

    //set timezone to default
    date_default_timezone_set('UTC');
    //this will give you the timestamp of today, 7:00:00 pm (which is 19 o' clock in 24hour system
    $time = mktime(19,0,0);
    

    you then can format the timestamp to whatever kind of format you need.