note 33234 added to function.date
| From: | GUGU_Brasil at rack1 dot php dot net | Date: | Thu, 19 Jun 2003 19:21:13 +0000 |
| Subject: | note 33234 added to function.date | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-50675@lists.php.net to get a copy of this message | ||
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.
----
Manual Page -- http://www.php.net/manual/en/function.date.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+33234
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+33234&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+33234&report=yes