Extracting date month and year from the date variable

Hi

How can I extract the day month and year from the date variable created in Survey Solution in STATA

Thank you

Stata has a special format for dates, so:

generate newvar=date(substr(exportvar,1,10),"YMD")
format newvar %td

After that you can extract individual date components with Stata functions year(), month(), day() as shown here:
https://stats.idre.ucla.edu/stata/faq/how-can-i-extract-month-and-year-component-from-a-variable-with-tm-format/

Best, Sergiy

Thank you Sergiy for the help