Notice
Recent Posts
Recent Comments
SNOWFLAKES DRAWING PAPER
[SQL] MySQL date_format 본문
MySQL date_format
Cut and Paste date_format strings for MySQL
select date_format(date, '%a %D %b %Y') as formatted_date from table_name;
Where date
is the name of your date field, and formatted_date
is a variable name which you can use to retrieve the value.
Example Date: 1st April 2005 Replace date with the name of your date field... |
|
date_format String | Example |
---|---|
<INPUT size="25" value="'%e/%c/%Y'"> | 1/4/2005 UK |
<INPUT size="25" value="'%c/%e/%Y'"> | 4/1/2005 US |
<INPUT size="25" value="'%d/%m/%Y'"> | 01/04/2005 UK |
<INPUT size="25" value="'%m/%d/%Y'"> | 04/01/2005 US |
<INPUT size="25" value="'%e/%c/%Y %H:%i'"> | 1/4/2005 12:30 UK |
<INPUT size="25" value="'%c/%e/%Y %H:%i'"> | 4/1/2005 12:30 US |
<INPUT size="25" value="'%d/%m/%Y %H:%i'"> | 01/04/2005 12:30 UK |
<INPUT size="25" value="'%m/%d/%Y %H:%i'"> | 04/01/2005 12:30 US |
<INPUT size="25" value="'%e/%c/%Y %T'"> | 1/4/2005 12:30:10 UK |
<INPUT size="25" value="'%c/%e/%Y %T'"> | 4/1/2005 12:30:10 US |
<INPUT size="25" value="'%d/%m/%Y %T'"> | 01/04/2005 12:30:10 UK |
<INPUT size="25" value="'%m/%d/%Y %T'"> | 04/01/2005 12:30:10 US |
<INPUT size="25" value="'%a %D %b %Y'"> | Fri 1st Apr 2005 |
<INPUT size="25" value="'%a %D %b %Y %H:%i'"> | Fri 1st Apr 2005 12:30 |
<INPUT size="25" value="'%a %D %b %Y %T'"> | Fri 1st Apr 2005 12:30:10 |
<INPUT size="25" value="'%a %b %e %Y'"> | Fri Apr 1 2005 |
<INPUT size="25" value="'%a %b %e %Y %H:%i'"> | Fri Apr 1 2005 12:30 |
<INPUT size="25" value="'%a %b %e %Y %T'"> | Fri Apr 1 2005 12:30:10 |
<INPUT size="25" value="'%W %D %M %Y'"> | Friday 1st April 2005 |
<INPUT size="25" value="'%W %D %M %Y %H:%i'"> | Friday 1st April 2005 12:30 |
<INPUT size="25" value="'%W %D %M %Y %T'"> | Friday 1st April 2005 12:30:10 |
If I've missed a common date format, get in touch and I'll add it.
분이 %i인것에 주의하자!
'개발 > Oracle/SQL/ERD' 카테고리의 다른 글
[SQL] MySQL 명령어 정리 (0) | 2009.04.18 |
---|---|
[SQL] MySQL 내장 함수 정리 (0) | 2009.04.18 |
[SQL] mysql event (0) | 2009.04.18 |
[SQL] Mysql - ErrCode (0) | 2009.04.18 |
[SQL] MYSQL :: cursor & insert error check example (0) | 2009.04.18 |
Comments