Pedro's blog: db2, mysql, php, linux and performance


DB2, the date and PHP
04/02/2010, 18:58
Filed under: General | Tags: , , , ,

Here comes the trick:

The common format when I get a date row from the db2 database is:

echo $date; //gets 2010-02-04 18:21:42

How did I make the magic with php:

$date        = strftime(“%d/%m/%Y”, strtotime($date));

echo $date; //gets 04/02/2010

Source: http://php.net/manual/en/function.strftime.php