How do you say? - ¿Cómo se dice? - I had fun last night.
Start with the infinitive, divertirse. This is a reflexive verb, so we take the pronoun ending, change it to the appropriate reflexive pronoun and, put it before the verb. Second, since this is preterite (past tense) make the appropriate change.
Me divertí anoche. If you really had fun, say, Me divertí mucho anoche!
Suppose you had fun with someone special.
Me divertí mucho anoche contigo!
me divierto - I am having fun
te diviertes - You are having fun
se divierte - He or she is having fun
nos divertimos - We are having fun
If it helps you to remember the verb, remember that English has a similar word for divertirse, diversion. English also has the noun divertisement, which means a diversion, amusement, or recreation.
For extra credit, how do you say, Are you enjoying yourself?
"¿Estás te divirtiendo?