how to calculate year,month,day,hour,minutes from specific date

Posted by Revanth533 under Sql Server on 7/23/2011 | Points: 10 | Views : 2338 | Status : [Member] | Replies : 4
how to calculate year,month,day,hour,minutes from specific date present in the database table to current date and time

revanth


Responses

Posted by: SheoNarayan on: 7/23/2011 [Administrator] HonoraryPlatinum | Points: 25

Up
0
Down
Hello Revanth,

It is not as simple as it looks, particularly to get the years difference.

Read this and use the download http://www.codeproject.com/KB/datetime/TimePeriod.aspx.

Thanks


Regards,
Sheo Narayan
http://www.dotnetfunda.com

Revanth533, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: PandianS on: 7/23/2011 [Member] [MVP] Silver | Points: 25

Up
0
Down
Hi

You can refer this link

http://sqlserverbuddy.blogspot.com/2011/06/hour-minute-second-between-two-date.html

Cheers
www.SQLServerbuddy.blogspot.com
iLink Multitech Solutions

Revanth533, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: RaviRanjanKr on: 7/24/2011 [Member] Starter | Points: 25

Up
0
Down
Try to learn about DATEDIFF function. have a look there
http://msdn.microsoft.com/en-us/library/ms189794.aspx

Thanks
Ravi Ranjan Kumar
http://raviranjankr.wordpress.com

Revanth533, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Lalji_mer on: 7/25/2011 [Member] Bronze | Points: 25

Login to post response