SQL Server Convert date time to n period ago
<p>I have a field <strong>lastLogin</strong> which is datetime.
I want to show the user his/her last login time as<br>
<strong>n years ago</strong>, if it is less that 1 year than<br>
<strong>n months ago</strong>, if it is less that 1 month than<br>
<strong>n days ago</strong>, if it is less that 1 day than<br>
<strong>n hours ago</strong>, if it is less that 1 hour than<br>
<strong>n minutes ago</strong>, if it is less that 1 minutes than<br>
<strong>n seconds ago</strong></p>

<p>I want that the <strong>s</strong> in years , months , days , hours , minures and seconds are handled automatically as the rules of English Grammar.</p>

<p>i am a complete beginner in sql and i am using <strong>SQL SERVER 2008 R2</strong></p>