Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 Script Library
 Date Calculation

Author  Topic 

nuruddean
Starting Member

11 Posts

Posted - 2010-05-05 : 02:43:25
I choose to retire on my 58 age.

My date of birth is 10/03/1980

I use this script:
sysdate + ((58 - round((sysdate - a.date_of_birth)/365,2)) * 365 )

the output is 02/25/2038
the year is correct but the date is incorrect, it should be 03/10/2038

please help me on this matter

My Name is Nuruddin

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-05-05 : 02:51:25
select dateadd(yy,58,'19801003')



No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-05-05 : 02:52:49
dup: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=144025


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

nuruddean
Starting Member

11 Posts

Posted - 2010-05-05 : 02:53:46
i dont understand...

My Name is Nuruddin
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2010-05-05 : 05:15:15
"dup" means DUPLICATE POST.



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page
   

- Advertisement -