function date_pad in Date 5
Same name and namespace in other branches
- 5.2 date_api.module \date_pad()
- 6.2 date_api.module \date_pad()
- 6 date_api.module \date_pad()
- 7.3 date_api/date_api.module \date_pad()
- 7 date_api/date_api.module \date_pad()
- 7.2 date_api/date_api.module \date_pad()
Helper function to left pad date parts with zeros. Provided because this is needed so often with dates.
Parameters
int $value: the value to pad
int $size: total size expected, usually 2 or 4
Return value
string the padded value
1 call to date_pad()
- date_ical_parse_date in ./
date_api_ical.inc - Parse a ical date element.
File
- ./
date_api.module, line 77 - A module that will make the date API available to other modules with no dependencies on CCK. To use it, install the module, then add the following code wherever date api functions are needed:
Code
function date_pad($value, $size = 2) {
return sprintf("%0" . $size . "d", $value);
}