note 19755 deleted from function.substr by sander

From: Date: Sun, 12 May 2002 15:49:28 +0000
Subject: note 19755 deleted from function.substr by sander
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-30533@lists.php.net to get a copy of this message
If you get a connection to a database and need to get a date from a mySQL DB in DATE format, then do like the following: (Assume that $date is the date from your mySQL DB) // Standard mySQL Date format - YYYY-MM-DD // What we want: DD-MM-YYYY $year = substr($date, 0, 4); $month = substr($date, 5, 7); $day = substr($date, 8, 10); $newdate = "$day-$month-$year"; echo $newdate;

« previous php.notes (#30533) next »