To examine time trends in the use of NSAIDs and opioids for patients with osteoarthritis undergoing total hip arthroplasty (THA) during 1996-2018. Using Danish population-based medical databases, we identified 103,209 THA patients. Prevalence rates of NSAID and opioid use among preoperative users and non-users were calculated in four quarters (Q1-Q4) after THA by calendar periods (1996-2000, 2001-2006, 2007-2012 and 2013-2018). Prevalence rate ratios (PRR) were adjusted for age and gender. Among preoperative NSAID users and non-users, NSAID use in Q1 increased from 32.6% in 1996-2000 to 48.0% in 2013-2018 (PRR=1.49, 95% CI: 1.42-1.55) and from 12.9% to 32.0% (PRR=2.49 (2.32-2.67)), respectively. Among preoperative opioid users and non-users, opioid use in Q1 increased from 42.7% in 1996-2000 to 76.9% in 2013-2018 (PRR=1.81 (1.73-1.89)) and from 15.2% to 58.2% (PRR=3.85 (3.65-4.05)), respectively. NSAID use in Q4 decreased from 24.5% in 1996-2000 to 21.4% in 2013-2018 (PRR=0.88 (0.83-0.93)) and from 6.9% to 5.6% (PRR=0.81 (0.73-0.91)) in preoperative NSAIDs users and non-users, respectively. Opioid use in Q4 increased from 26.6% in 1996-2000 to 28.6% (PRR=1.08 (1.02-1.15)) in 2013-2018 and from 4.1% to 5.0% (PRR=1.25 (1.11-1.40)) in preoperative opioid users and non-users, respectively. We observed up to a 4-fold increase in NSAID and opioid use in Q1 during 1996-2018, while usage in Q4 did not change substantially. However, 5-6% of the preoperative non-users of NSAIDs and opioids were users in Q4, which might relate to inaccurate indication for or timing of THA and the post-surgical phasing out of analgesics use.