You are here

public static function OfficeHoursDateHelper::datePad in Office Hours 8

Pads date parts with zeros.

Helper function for a task that is often required when working with dates. Copied from DateTimePlus::datePad($value, $size) method.

Parameters

int $value: The value to pad.

int $size: (optional) Size expected, usually 2 or 4. Defaults to 2.

Return value

string The padded value.

Deprecated

replaced with OfficeHoursDatetime::get($value, $format)

See also

OfficeHoursDatetime::get($value, $format)

File

src/OfficeHoursDateHelper.php, line 79

Class

OfficeHoursDateHelper
Defines lots of helpful functions for use in massaging dates.

Namespace

Drupal\office_hours

Code

public static function datePad($value, $size = 2) {
  return sprintf("%0" . $size . "d", $value);
}