Top Menu

Pages

Saturday, June 22, 2013

Truncate minute and second timestamp from date value in SQL

Suppose we retrieve a variable 'Valuation_Date' from SQL database and get following number

2012-01-22 00:00:00.000

We can use convert function to truncate minute and second timestamp using the convert function

convert(varchar(8), Valuation_Date, 112)

then we will get following reault:

20120122

No comments:

Post a Comment