0

I want to store a datetime format in a datetime column.

The format i want to use is: 14-05-2012 14:08:54

Is the above by the way possible?

The reason for this is that we use Excel sheets to read from the database and using this format will help us a lot in our daily work.

Please advise.

I appreciate your help and answers.

4

2 回答 2

4

I am not sure if there is an exact output format for the desired result. But I got this to work

SELECT CONVERT(varchar(10), getdate(), 105) 
       + ' ' + CONVERT(varchar(8), GETDATE(), 108)
于 2013-05-28T14:41:39.753 回答
1

日期时间是日期时间,它与任何特定格式无关。如果您需要格式化日期时间,请使用:

select convert( char(10), getdate(), 105) +  ' ' + convert( char(8), getdate(), 108)
于 2013-05-28T14:33:47.067 回答