|
select
Date() as “ú•t•”•ª
,Time() as ŽžŠÔ•”•ª
,Now() as “ú•t‚ÆŽžŠÔ1
,Now as “ú•t‚ÆŽžŠÔ2
,Year('2010/01/21 1:02:03') as ”N1
,Month('2010/01/21 1:02:03') as ŒŽ1
,Day('2010/01/21 1:02:03') as “ú1
,Hour('2010/01/21 1:02:03') as Žž1
,Minute('2010/01/21 1:02:03') as •ª1
,Second('2010/01/21 1:02:03') as •b1
,Now() + 1 as “ú”‰ÁŽZ1
,DateAdd('d', 1, Now()) as “ú”‰ÁŽZ2
,DateAdd('m', -1, Now()) as ŒŽ”‰ÁŽZ
,DateAdd('yyyy', 1, Now()) as ”N”‰ÁŽZ
,DateAdd('ww', -1, Now()) as T”‰ÁŽZ
,DateDiff('d', '2005/01/01', Now()) as Œo‰ß“ú”
,DatePart('yyyy', Now()) as ”N2
,DatePart('m', Now()) as ŒŽ2
,DatePart('d', Now()) as “ú2
,DatePart('h', Now()) as Žž2
,DatePart('n', Now()) as •ª2
,DatePart('s', Now()) as •b2
,DatePart('w', Now()) as —j“ú
,DatePart('ww', Now()) as T
,DatePart('y', Now()) as ”NŠÔ’ÊŽZ“ú
,DateValue('H1/01/01') as •½¬
,DateValue('S1/01/01') as º˜a
,DateValue('T1/01/01') as ‘å³
,DateValue('M1/01/01') as –¾Ž¡
,Format('2005/01/01', 'yyyy/MM/dd') as “ú•t•¶Žš—ñ1
,Format('2005/01/01', 'yyyy/M/d') as “ú•t•¶Žš—ñ2
“ú•t•”•ª | ŽžŠÔ•”•ª | “ú•t‚ÆŽžŠÔ1 | “ú•t‚ÆŽžŠÔ2 | ”N1 |
2010/01/21 | 2:12:38 | 2010/01/21 2:12:38 | 2010/01/21 2:12:38 | 2010 |
ŒŽ1 | “ú1 | Žž1 | •ª1 | •b1 |
1 | 21 | 1 | 2 | 3 |
“ú”‰ÁŽZ1 | “ú”‰ÁŽZ2 | ŒŽ”‰ÁŽZ | ”N”‰ÁŽZ | T”‰ÁŽZ |
2010/01/22 2:12:38 | 2010/01/22 2:12:38 | 2009/12/21 2:12:38 | 2011/01/21 2:12:38 | 2010/01/14 2:12:38 |
Œo‰ß“ú” | ”N2 | ŒŽ2 | “ú2 | Žž2 |
1846 | 2010 | 1 | 21 | 2 |
•ª2 | •b2 | —j“ú | T | ”NŠÔ’ÊŽZ“ú |
12 | 38 | 5 | 4 | 21 |
•½¬ | º˜a | ‘å³ | –¾Ž¡ | “ú•t•¶Žš—ñ1 |
1989/01/01 | 1926/01/01 | 1912/01/01 | 1868/01/01 | 2005/01/01 |
“ú•t•¶Žš—ñ2 | | | | |
2005/1/1 | | | | |
|
select
switch(
Weekday(now)=1,'“ú'
,Weekday(now)=2,'ŒŽ'
,Weekday(now)=3,'‰Î'
,Weekday(now)=4,'…'
,Weekday(now)=5,'–Ø'
,Weekday(now)=6,'‹à'
,Weekday(now)=7,'“y'
) as —j“ú1
,switch(
Weekday(now,2)=1,'ŒŽ'
,Weekday(now,2)=2,'‰Î'
,Weekday(now,2)=3,'…'
,Weekday(now,2)=4,'–Ø'
,Weekday(now,2)=5,'‹à'
,Weekday(now,2)=6,'“y'
,Weekday(now,2)=7,'“ú'
) as —j“ú2;
| |
|
Microsoft ƒhƒLƒ…ƒƒ“ƒg
Format ŠÖ”‚Ì“ú•t‚ÆŽžŠÔ‚Ì‘Ž®
DateValue ŠÖ”
Weekday ŠÖ”
|
|
|
select
GETDATE() + 1 as “ú”‰ÁŽZ1
,DATEADD(d, 1, GETDATE()) as “ú”‰ÁŽZ2
,DATEADD(m, -1, GETDATE()) as ŒŽ”‰ÁŽZ
,DATEADD(yy, 1, GETDATE()) as ”N”‰ÁŽZ
,DATEADD(ww, -1, GETDATE()) as T”‰ÁŽZ
,DATEDIFF(d, '2005/01/01', GETDATE()) as Œo‰ß“ú”
,DATEPART(d, GETDATE()) as “ú
,DATEPART(y, GETDATE()) as ”NŠÔ’ÊŽZ“ú
,DATEPART(hh, GETDATE()) as Žž
,DATEPART(n, GETDATE()) as •ª
,DATEPART(s, GETDATE()) as •b
,DATEPART(ms, GETDATE()) as milli•b
,DATEPART(m, GETDATE()) as ŒŽ
,DATEPART(w, GETDATE()) as —j“ú
,DATEPART(ww, GETDATE()) as T
,DATEPART(yyyy, GETDATE()) as ”N
,CONVERT(varchar, GETDATE(),120) as “ú•t•ÒW1
,CONVERT(varchar, GETDATE(),111) as “ú•t•ÒW2
,CONVERT(varchar, GETDATE(),11) as “ú•t•ÒW3
,CONVERT(varchar, GETDATE(),112) as “ú•t•ÒW2
,CONVERT(varchar, GETDATE(),12) as “ú•t•ÒW3
| |
|
Microsoft ‚Ì CONVERTŠÖ” ‚̃Xƒ^ƒCƒ‹ˆê—— ‚ւ̃Šƒ“ƒN
œ“ú”‰ÁŽZ1 | œ“ú”‰ÁŽZ2 | œŒŽ”‰ÁŽZ | œ”N”‰ÁŽZ | |
2008/03/26 10:52:30 | 2008/03/26 10:52:30 | 2008/02/25 10:52:30 | 2009/03/25 10:52:30 | |
œT”‰ÁŽZ | œŒo‰ß“ú” | œ“ú | œ”NŠÔ’ÊŽZ“ú | |
2008/03/18 10:52:30 | 1179 | 25 | 85 | |
œŽž | œ•ª | œ•b | œmilli•b | |
10 | 52 | 30 | 173 | |
œŒŽ | œ—j“ú | œT | œ”N | |
3 | 3 | 13 | 2008 | |
œ“ú•t•ÒW1 | œ“ú•t•ÒW2 | œ“ú•t•ÒW3 | œ“ú•t•ÒW2 | œ“ú•t•ÒW3 |
2008-03-25 10:52:30 | 2008/03/25 | 08/03/25 | 20080325 | 080325 |
|
|
|
select
NOW() + INTERVAL 1 DAY as “ú”‰ÁŽZ1
,DATE_ADD(NOW(),INTERVAL 1 DAY) as “ú”‰ÁŽZ2
,DATE_ADD(NOW(),INTERVAL -1 MONTH) as ŒŽ”‰ÁŽZ
,DATE_ADD(CURDATE(),INTERVAL 1 YEAR) as ”N”‰ÁŽZ
,TO_DAYS(NOW()) - TO_DAYS(CAST('2005/01/01' as DATETIME)) as Œo‰ß“ú”
,DATE_FORMAT(NOW(),'%d') as “ú
,DATE_FORMAT(NOW(),'%j') as ”NŠÔ’ÊŽZ“ú
,DAYOFYEAR(NOW()) as ”NŠÔ’ÊŽZ“ú
,DATE_FORMAT(NOW(),'%H') as Žž
,DATE_FORMAT(NOW(),'%i') as •ª
,DATE_FORMAT(NOW(),'%S') as •b
,DATE_FORMAT(NOW(),'%m') as ŒŽ
,DATE_FORMAT(NOW(),'%w') as —j“ú
,DATE_FORMAT(NOW(),'%U') as T
,DATE_FORMAT(NOW(),'%Y') as ”N
,DATE_FORMAT(NOW(),'%Y-%m-%d') as “ú•t
| |
|
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
“ú”‰ÁŽZ1 | “ú”‰ÁŽZ2 | ŒŽ”‰ÁŽZ | ”N”‰ÁŽZ | Œo‰ß“ú” | “ú | ”NŠÔ’ÊŽZ“ú | ”NŠÔ’ÊŽZ“ú |
2009-03-14 16:18:34 | 2009-03-14 16:18:34 | 2009-02-13 16:18:34 | 2010-03-13 | 1532 | 13 | 072 | 72 |
Žž | •ª | •b | ŒŽ | —j“ú | T | ”N | “ú•t |
16 | 18 | 34 | 03 | 5 | 10 | 2009 | 2009-03-13 |
|
|
ŠÂ‹«•Ï” TZ=JST-9
|
select
now(),localtime
,now() + interval '1 day' as “ú”‰ÁŽZ
,now() + interval '-1 month' as “ú”‰ÁŽZ
,now() + interval '1 year' as ”N”‰ÁŽZ
,current_date - '2005/01/01' as Œo‰ß“ú”
,date_part('day', now()) as “ú
,date_part('doy', now()) as ”NŠÔ’ÊŽZ“ú
,date_part('hour', now()) as Žž
,date_part('minute', now()) as •ª
,date_part('second', now()) as •b
,date_part('milliseconds', now()) as milli•b
,date_part('month', now()) as ŒŽ
,date_part('dow', now()) as —j“ú
,date_part('week', now()) as T
,date_part('year', now()) as ”N
,to_char(now(), 'YYYY/MM/DD HH24:MI:SS') as “ú•t•¶Žš—ñ1
,to_char(now(), 'YYYY/FMMM/FMDD FMHH24:FMMI:FMSS') as “ú•t•¶Žš—ñ2
| |
|
1 | 2 | 3 | 4 | 5 | 6 |
now | time | “ú”‰ÁŽZ | “ú”‰ÁŽZ | ”N”‰ÁŽZ | Œo‰ß“ú” |
2009-03-13 16:31:50.503238+09 | 16:31:50.503238 | 2009-03-14 16:31:50.503238+09 | 2009-02-13 16:31:50.503238+09 | 2010-03-13 16:31:50.503238+09 | 1532 |
“ú | ”NŠÔ’ÊŽZ“ú | Žž | •ª | •b | milli•b |
13 | 72 | 16 | 31 | 50.503238 | 50503.238 |
ŒŽ | —j“ú | T | ”N | “ú•t•¶Žš—ñ1 | “ú•t•¶Žš—ñ2 |
3 | 5 | 11 | 2009 | 2009/03/13 16:31:50 | 2009/3/13 16:31:50 |
|
|
|
select
sysdate
,sysdate + 1 as “ú”‰ÁŽZ
,ADD_MONTHS( sysdate, -1 ) as ŒŽ”‰ÁŽZ
,ADD_MONTHS( sysdate, 1 * 12 ) as ”N”‰ÁŽZ
,TRUNC(sysdate)-TO_DATE('2005/01/01') as Œo‰ß“ú”
,EXTRACT(day from sysdate) as “ú
,EXTRACT(month from sysdate) as ŒŽ
,EXTRACT(year from sysdate) as ”N
,TO_CHAR(sysdate,'HH24') as Žž
,TO_CHAR(sysdate,'MI') as •ª
,TO_CHAR(sysdate,'SS') as •b
,TO_CHAR(sysdate,'DDD') as ”NŠÔ’ÊŽZ“ú
,TO_CHAR(sysdate,'D') as —j“ú
,TO_CHAR(sysdate,'WW') as T
,TO_CHAR(sysdate,'YYYY/MM/DD HH24:MI:SS') as “ú•t•¶Žš—ñ
,MONTHS_BETWEEN(sysdate,'2005/01/01') as ŠúŠÔŒŽ”
,TO_CHAR(LAST_DAY(sysdate),'DD') as ŒŽ‚ÌÅI“ú
from dual
| |
|
|
|