How to round unix timestamp up and down to nearest half hour?

后端 未结 10 2079
名媛妹妹
名媛妹妹 2020-12-14 17:16

Ok so I am working on a calendar application within my CRM system and I need to find the upper and lower bounds of the half an hour surrorunding the timestamp at which someb

10条回答
  •  天命终不由人
    2020-12-14 17:46

    I'd use the localtime and the mktime function.

    $localtime = localtime($time, true);
    $localtime['tm_sec'] = 0;
    $localtime['tm_min'] = 30;
    $time = mktime($localtime);
    

提交回复
热议问题