Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Date to string (with mask)

0 views
Skip to first unread message

Christian Ista

unread,
Nov 8, 2003, 5:45:47 AM11/8/03
to php-g...@lists.php.net
Hello,

I have in a database a date field (this format yyy/mm/dd). I'd like when I
display the value use an another format dd/mm/yyyy (format in europ), could
you tell me if there is a format DateString function ?

Thanks,

Christian,

Filip De Waard

unread,
Nov 8, 2003, 9:23:22 AM11/8/03
to php-g...@lists.php.net

http://www.php.net/date

Cheers,

Filip de Waard

Filip De Waard

unread,
Nov 8, 2003, 9:31:52 AM11/8/03
to Christian Ista, php-g...@lists.php.net
On Sat, 2003-11-08 at 15:21, Christian Ista wrote:
> <?php echo mysql_result($result_cat,0,"CATC_DATE");?>
>
> a string like that : 2003-11-07 and I'd like display 07/11/2003

I usually do:

<?
$query = "SELECT UNIX_TIMESTAMP(datefield) as unixtime FROM table";
$timestamp = mysql_result($result, "unixtime");

$date = date("d/m/Y", $timestamp);

echo $date;
?>

Regards,

Filip de Waard

0 new messages