Skip to content

Instantly share code, notes, and snippets.

@immanuelsun
Created March 13, 2016 22:44
Show Gist options
  • Save immanuelsun/b9e85acbd880d9d49658 to your computer and use it in GitHub Desktop.
Save immanuelsun/b9e85acbd880d9d49658 to your computer and use it in GitHub Desktop.
PHP: strip zeros from `date()`.
function strip_zeros_from_date($marked_string = "")
{
// remove the marked zeros
$no_zeros = str_replace("*0", "", $marked_string);
// remove any remaining zeros
$cleaned_string = str_replace("*", "", $no_zeros);
return $cleaned_string;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment