sql 中 時間只顯示日期

2022-09-05 11:03:16 字數 1189 閱讀 2348

問題的出現:資料庫中日期存放格式包含時間;有時候只需要日期不要時間

解決:ql語句擷取時間,只顯示年月日(2004-09-12)

select convert(varchar, 欄位名, 120 )

eg:select convert(varchar(11),vc_createdate,120) '日期' from table

擴充套件:其他格式

select convert(varchar(12) , getdate(), 111 )

2004/09/12

select convert(varchar(12) , getdate(), 112 )

select convert(varchar(12) , getdate(), 102 )

2004.09.12

select convert(varchar(12) , getdate(), 101 )

09/12/2004

select convert(varchar(12) , getdate(), 103 )

12/09/2004

select convert(varchar(12) , getdate(), 104 )

12.09.2004

select convert(varchar(12) , getdate(), 105 )

12-09-2004

select convert(varchar(12) , getdate(), 106 )

12 09 2004

select convert(varchar(12) , getdate(), 107 )

09 12, 2004

select convert(varchar(12) , getdate(), 108 )

11:06:08

select convert(varchar(12) , getdate(), 109 )

09 12 2004 1

select convert(varchar(12) , getdate(), 110 )

09-12-2004

select convert(varchar(12) , getdate(), 113 )

12 09 2004 1

select convert(varchar(12) , getdate(), 114 )

11:06:08.177 

EasyUi日期控制項datebox 只顯示年月

dateboxformat period export function dateboxformat dateid exec span.html 0 月份 month parseint this attr abbr 10 隱藏日期物件 dateid datebox hidepanel 設定日期的值 ...

easyui日期外掛程式改進,只顯示年月

考慮到企業成長資料庫中有大量的 資料用easyui外掛程式來簡化一下開發,然而一點都不省力啊,由於涉及到需要不同格式的時間,所以根據不同格式改進了下,目前還沒有找到較好的只顯示年的方法。1.easyui日期外掛程式改進 只顯示年月 格式例如2017年8月 yyyymm id function yyy...

sql日期時間

1 sybase 周五至周四 select convert varchar 10 dateadd day,1 datepart weekday,getdate getdate 111 select convert varchar 10 dateadd day,5 datepart weekday,g...