note 46192 deleted from function.date by tularis
| From: | tularis@php.net | Date: | Sun, 30 Jan 2005 14:43:45 +0000 |
| Subject: | note 46192 deleted from function.date by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-84226@lists.php.net to get a copy of this message | ||
Note Submitter: Baldurien at club-internet dot fr
----
In addition to rafaelr at veloxmail dot com dot br :
If you use mySQL, then do it in SQL :
1. If you use a TIMESTAMP, or any DATETIME fields just use this (see http://dev.mysql.com/doc/mysql/en/DATETIME.html
) and then convert with date()
SELECT UNIX_TIMESTAMP(field) AS field
FROM table
or better use DATE_FORMAT (http://dev.mysql.com/doc/mysql/en/Date_and_time_functions.html ), I think
it use the same format as strftime (http://fr.php.net/manual/fr/function.strftime.php ) do.
2. If you'are not using a date fields but something of your own kind :
use mySQL function STR_TO_DATE
For your date :
SELECT
UNIX_TIMESTAMP(STR_TO_DATE('20/10/2003', '%d/%m/%Y'))
Nota: it will depend on your criteria