Skip to content

Instantly share code, notes, and snippets.

@Dynom
Last active August 29, 2015 14:01
Show Gist options
  • Save Dynom/19a6446c78c87f607b84 to your computer and use it in GitHub Desktop.
Save Dynom/19a6446c78c87f607b84 to your computer and use it in GitHub Desktop.
<?php
$roundingInMinutes = 2;
$roundingInSeconds = ($roundingInMinutes * 60);
$t = time();
$rounded = ($t - ($t % $roundingInSeconds));
$previousRounded = $rounded - $roundingInSeconds;
var_dump(
date("H:i:s d-m-Y", $rounded),
date("H:i:s d-m-Y", $previousRounded)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment