Format a date value with printf in PHP

Description

The following code shows how to format a date value with printf.

Example


<?php
printf( "%02d/%02d/%d", 3, 24, 2008 ); // Displays "03/24/2008"
?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    Data Types »




Array
Array Associative
Array Util
ArrayObject
Data Types
Date
Date Format
DateTime
Number
String
String Escape
String Filter
String HTML
String Type
Timezone