getdate tsql question -


how write tsql calculates following:

  1. the current date , mid night such 2010-12-01 00:00:00.000
  2. the current date , 6pm such 2010-12-01 18:00:00.000

thanks..

you can try following

select dateadd(dd, datediff(dd, 0, getdate()), 0) datenotime,      dateadd(hh, 18, dateadd(dd, datediff(dd, 0, getdate()), 0)) datenewtime 

Comments

Popular posts from this blog

Add email recipient to all new Trac tickets -

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -