Skip to content

Instantly share code, notes, and snippets.

@morganestes
Last active December 21, 2015 00:49
Show Gist options
  • Select an option

  • Save morganestes/6223141 to your computer and use it in GitHub Desktop.

Select an option

Save morganestes/6223141 to your computer and use it in GitHub Desktop.
Add a leading zero to months 1-9 for displaying. This makes the number a string.
<?php
$month = sprintf("%02s", $month);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment