SQL Server Note

日時を日本の形式に変換

日時を日本の形式(YYYY/MM/DD HH:MM:DD)に変換する方法です。

SELECT NAME,BUYDATE, 
CONVERT(VARCHAR,BUYDATE,111) + ' ' + 
CONVERT(VARCHAR,BUYDATE,108)
AS CONVDATE
FROM PC
NAMEBUYDATECONVDATE
CL-BAD1900-01-01 00:00:00.0001900/01/01 00:00:00
CL-NONENULLNULL
CL-SAITO2000-03-15 14:10:05.0002000/03/15 14:10:05
CL-SHARE1995-06-13 00:00:00.0001995/06/13 00:00:00
CL-UEDA2001-01-11 18:20:15.0002001/01/11 18:20:15
CL-YOSHIDA2000-03-12 00:00:00.0002000/03/12 00:00:00
SV-FILE2000-08-01 00:00:00.0002000/08/01 00:00:00
SV-MAIL1999-12-16 13:50:52.0001999/12/16 13:50:52
SV-WEB2001-01-11 01:03:18.0002001/01/11 01:03:18
Copyright © 2006 Hikijishi All Rights Reserved.
[] [sql][0.0012059211730957]