Hello Every one
I want to calculate the last updated time in database.
means it should display like last updated 2 hours before or 2 days before
so how can i do that? I am sending the current date to the database.
please help me!
Take a look at DATEDIFF ( datepart , startdate , enddate ). The datepart parameter represents what part of the date you want calculated. So you may need to do several sql statements to get all the information. Such as:
DATEDIFF ( n , startdate , enddate ) //for minutes
DATEDIFF ( hh , startdate , enddate ) //for hours
DATEDIFF ( dd, startdate , enddate ) //for days
Once you have that then you can and then you can just concatenate them into one string to display your information back to the users.