sql server - Twitter style timeline with MSSQL 2008 -


I am trying to compare dates and display differences in Twitter style format (2 seconds ago, 1 minute ago , 2 days ago etc.) with MSSQL 2008. Any help would be greatly appreciated thanks in advance.

Will this help you? You may have to add more conditions for days and weeks

  declare @ dtetime = getdate (); @ PostStyle declare datetime = dateadd (seconds, -2, demet); Announce; Set @ Diff = datediff (SECOND, @ posttime, @ dt) when @fiff < Select 60 then convert (varchar (2), @ diff) + 'seconds first' when defragment between 60 and 3599, then convert (varchar (2), @ diff / 60) + 'minutes ago' and convert (Varchar (2), @ diff / 3600) + 'hours ago' end - The next post that was set approximately 1 minute ago @ posttime = dateadd (SECOND, - 62, getdate ()); Set @ Diff = datediff (SECOND, @ posttime, @ dt) when @fiff < Select 60 then convert (varchar (2), @ diff) + 'seconds first' when defragment between 60 and 3599, then convert (varchar (2), @ diff / 60) + 'minutes ago' and convert (Varchar (2), @ diff / 3600) + 'hours ago'    

Comments

Popular posts from this blog

python - how we can use ajax() in views.py in django? -

matlab - Using loops to get multiple values into a cell -

python - Sequence Pattern recognition with Pybrain -