print

convert_date ()

You are here: C97net5.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);
?>
Posted on: Aug-23-2010 at 07:00am
Last Updated: Jan-01-1970 at 07:00am

There is no comment. Why not be the first?

read more More Comments/Post Your Own

Account

Search

Tags

acp add all also any create default display don download easy echo etc features field file files folder form function includes information init kemana link list may module name need number own page php please qengine read require script set site skin time tpl url use user using version welcome