Speed up development with full-stack environments for every branch.

Learn More

format date with sprintf [PHP]

Forked from Hello World.

540 Runs 3443 Views 1042 Copies


pbroschwitz 1

published 3 years ago

    $year = '1993'; $month = '3'; $day = '4';
    echo sprintf("Year, month and day are %s, %s, %s", $year, $month, $day);
    $date = sprintf('%04d-%02d-%02d', $year, $month, $day);
    echo "\n<br>Formatted date is " . $date; 
    Please login/signup to get access to the terminal.

    Your session has timed out.

    Dismiss (the page may not function properly).