note 46192 added to function.date
| From: | Baldurien at club-internet dot fr | Date: | Fri, 01 Oct 2004 19:29:08 +0000 |
| Subject: | note 46192 added to function.date | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-77699@lists.php.net to get a copy of this message | ||
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
----
Manual Page -- http://www.php.net/manual/en/function.date.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+46192
Delete -- http://master.php.net/manage/user-notes.php?action=delete+46192&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+46192&report=yes
Search -- http://master.php.net/manage/user-notes.php