문제

Using t-sql string functions

substring(convert(varchar, getdate(), 120),6, 11)

this will return mm-dd hh:mm

But then how do I get datetime format yy-mm-dd hh:mm ?

Thank you so much in advance.

도움이 되었습니까?

해결책

Well, convert(varchar(25), getdate(), 120) returns:

          1
1234567890123456789
2013-08-08 01:43:49

So change:

substring(..., 6, 11)

To:

substring(..., 3, 14)

And you'll get:

13-08-08 01:43
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top