Syntax for Recoding Dates

#1
I have a range of dates from ~1950 to the present that are in the 5 digit Excel/Microsoft date code. I'd like to create date ranges.
I'm looking for something like

recode date into year
(42005 thru 42369) = 2015

(the above syntax might be off by a bit, but you get the picture!)

Does anyone have syntax for this for the Excel/Microsoft dates or know of an efficient way to do this?

Thanks in advance!
 
#2
This is a reasonably common conversion and should come up pretty readily in a web search but here is how to convert those day values into a date and then extract the year.

Code:
compute newdate = ((mydate-2)*24*60*60) + date.dmy(1,1,1900).
compute year=xdate.year(newdate). 
formats newdate (edate10).
exe.
 
#3
Thanks! I did find a lot by searching, I was hoping to find a list of the Excel dates translated into the "regular" dates.
Can you explain this calculation?

((mydate-2)*24*60*60)