how to format getdate into YYYYMMDDHHmmSS

后端 未结 7 1724
春和景丽
春和景丽 2021-02-19 04:50

In SQL Server how do I format getdate() output into YYYYMMDDHHmmSS where HH is 24 hour format?

I\'ve got the YYYYMMDD

7条回答
  •  春和景丽
    2021-02-19 05:31

    Try this:

    select CONVERT(varchar, GETDATE(), 120) e.g.

    2011-09-23 12:18:24 (yyyy-mm-dd hh:mi:ss (24h) ,ODBC canonical).

    Hth.

提交回复
热议问题