I want the date and time to be displayed as something like this on my page :-
1 minute ago
25 minutes ago
45 minutes ago
4 hours ago
3 weeks ago
my stored procedure returns the date in the following format:-
2011-02-08 13:14:44.513
Can I format it the way I want it to be displayed in the SP only or do i have to do coding in the code behind of my aspx page?
As far as I know there is no built in function to do this, however a case statement and some math can return what you want.
I agree that it should be done behind the application rather than at the database level but that being said. Here is some code I threw together as an example, you should be able to modify it for your needs.