I am having trouble converting this format in the SQL SERVER 2008 datatime format YYYYMMDD:hhmmss,
can someone assist me?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
David SmithPosted Mar 13, 2012, 2:17 AM
DELETE
FROM Color
WHERE REPLACE(CONVERT(VARCHAR,Color.CreatedDateTime, 102),'.','/') +' '+ CONVERT(VARCHAR, Color.CreatedDateTime, 108) < (GETDATE()-30)
David SmithPosted Mar 13, 2012, 2:06 AM
Gohil JayendrasinhPosted Mar 13, 2012, 1:42 AM
http://www.technoreader.com/SQL-Server-Date-Time-Format.aspx
http://www.sqlusa.com/bestpractices2005/centurydateformat/
if Asnwer is working for you then
Please check Accepted Asnwers
SenthilkumarPosted Mar 13, 2012, 1:41 AM
Use this query. You will get the format.
SELECT REPLACE(CONVERT(VARCHAR, GETDATE(), 102),'.','/') +' '+ CONVERT(VARCHAR, GETDATE(), 108) AS [DateFormat]