2016-07-26 75 views

回答

0

試試這個

DECLARE @Date datetime = '2016-07-07 16:46:23.057' 
DECLARE @NewSeconds int = 0 -- from 0 to 59 - what you want to replace the original seconds with 
DECLARE @NewDate datetime 

SET @NewDate = DATEADD(ss, @NewSeconds, DATEADD(ss, -DATEPART(ss, @Date), @Date)) 

SELECT @NewDate 
0
set @new_value = dateadd(s, -datepart(s, @old_value), @old_value) 
0
select CONVERT(varchar(10),getdate(),121) +' ' + right('00'+cast(DATEPART(HOUR,getdate()) as varchar(4)),2)+ ':' + right('00'+cast(DATEPART(MINUTE,getdate()) as varchar(4)),2)+ ':00:' + right('000'+cast(DATEPART(MS,getdate()) as varchar(4)),3) 
相關問題