Re: date format display
| From: | Manuel | Date: | Mon, 10 Jun 2002 13:30:12 +0000 |
| Subject: | Re: date format display | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-19716@lists.php.net to get a copy of this message | ||
This function will fix your date display.
$sqldate="20020531";
$sqldate= fixdate($sqldate);
function fixdate($data){
$aux="";
$z=0;
for($i=0; $i<strlen($data); $i++) {
if($i<=3) {
$aux[0].=$data[$i];
}
if($i==4 or $i==5) {
$aux[1].=$data[$i];
}
if($i==6 or $i==7) {
$aux[2].=$data[$i];
}
}
$mdate= $aux[1]."/".$aux[2]."/".$aux[0];
if(checkdate($aux[1], $aux[2], $aux[0])) {
Return $mdate;
}
else {
Return "ERROR";
}
}
fabrizio <fabrizio@sad.it> wrote: Hello dear all,
in my mysql-db I have a date_tbl with this format: (20020531).
how is possible in PHP do display date_tbl's values in a more human-readable
format like 05-31-2002 or 31/05/2002 ?
thaks in advance,
regards
fabrizio
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
~ Manuel Ochoa ~
Seven days is too long to wait for a gun!
---------------------------------
Do You Yahoo!?
Sign-up for Video Highlights of 2002 FIFA World Cup