Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> jak zmienic format daty w mysql??
mk.gda
post
Post #1





Grupa: Zarejestrowani
Postów: 8
Pomógł: 0
Dołączył: 28.01.2004
Skąd: Gdańsk

Ostrzeżenie: (0%)
-----


pole DATE zapisuje date w formacie yyyy-mm-dd. jak zmienic na dd-mm-yyyy??
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
spenalzo
post
Post #2





Grupa: Zarejestrowani
Postów: 2 064
Pomógł: 1
Dołączył: 22.01.2003
Skąd: Poznań

Ostrzeżenie: (0%)
-----


http://www.mysql.com/doc/en/Date_and_time_..._functions.html
Cytat
STR_TO_DATE(str,format)
   This is the reverse function of the DATE_FORMAT() function. It takes a string str, and a format string format, and returns a DATETIME value. The date, time, or datetime values contained in str should be given in the format indicated by format. For the specifiers that can be used in format, see the table in the DATE_FORMAT() function description. All other characters are just taken verbatim, thus not being interpreted. If str contains an illegal date, time, or datetime value, STR_TO_DATE() returns NULL.

mysql> SELECT STR_TO_DATE('03.10.2003 09.20', '%d.%m.%Y %H.%i')
       -> 2003-10-03 09:20:00
mysql> SELECT STR_TO_DATE('10rap', '%crap')
       -> 0000-10-00 00:00:00
mysql> SELECT STR_TO_DATE('2003-15-10 00:00:00', '%Y-%m-%d %H:%i:%s')
       -> NULL



dd.mm.rrrr,
[sql:1:3541d7af31]SELECT STR_TO_DATE('03.10.2003', '%d.%m.%Y')[/sql:1:3541d7af31]

dd-mm-rrrr,
[sql:1:3541d7af31]SELECT STR_TO_DATE('03-10-2003', '%d-%m-%Y')[/sql:1:3541d7af31]

dd/mm/rrrr?
[sql:1:3541d7af31]SELECT STR_TO_DATE('03/10/2003', '%d/%m/%Y')[/sql:1:3541d7af31]
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 10.10.2025 - 16:47