note 33234 rejected from function.date by pollita
| From: | pollita@php.net | Date: | Sat, 26 Jul 2003 16:58:27 +0000 |
| Subject: | note 33234 rejected from function.date by pollita | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-52712@lists.php.net to get a copy of this message | ||
Note Submitter: GUGU_Brasil
----
USE THIS IF U HAVE PROBLEM WHEN FORMATING DATE. IF YOUR SERVER IS WINDOWS, THE PHP WILL UNDERSTAND
THE DATE FUNCTION OK. BUT IF YOUR SYSTEM WILL RUN ON A UNIX PLATAFORM, U HAVE TO TRANSLATE A STRING
TO DATE SO THAT THE UNIX CAN UNDERSTAND THE DATETIME AS DATE.
0.PROBLEM: ECHOS WRONG DATE. (Ususally: 1969-02-12);
1.SOLVER:
//on RecordSets, lives the DateTime Field From your Database Table
$DATE_STR = $RECORD_SET->FIELD["DATE_TIME_FIELD"];
//use strtotime(); function to tell Server that this STR is a DATE. WORKS for UNIX SERVER.
$DATE = strtotime($DATE_STR);
//use date(); Then The Server Will Understand the DATE as DATE and format it as U desire.
$STR_OF_DATE = date("d-m-Y h:i:s",$DATE);
//I hope this could help,
//GUGU_BRASIL.