You are here: C97net • 5.03 Date & Time Functions
Convert SQL formatted date to human readable format
function convert_date ($sql_date, $mode = '0', $days = 0)
Use this function to convert SQL formatted date (YYYY-MM-DD) $sql_date to human readable format.
$sql_date = the date to be converted. You can also use 'today' or 'now' to use today date.
$mode = can be:
$days = enter a number to see the date in the future or past $days.
If you set multiligual date in ACP > Configuration, this function will return the date in your local language (set in includes/lang.php file).
Example 1
<?php
require './includes/user_init.php';
// return current date, eg:
// Monday, August-23-2010
echo convert_date ('today', 'long');
// return 7 days ahead, eg:
// Aug-30-2010
echo convert_date ('today', 'short', 7);
?>
There is no comment. Why not be the first?