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
Use modulo.
$prev = 1330518155 - (1330518155 % 1800); $next = $prev + 1800;
The modulo operator gives the remainder part of division.