Pads date parts with zeros.
Helper function for a task that is often required when working with dates.
int $value: The value to pad.
int $size: (optional) Size expected, usually 2 or 4. Defaults to 2.
string The padded value.
public static function datePad($value, $size = 2) {
return sprintf("%0" . $size . "d", $value);
}