Preheat your oven to 350°F (175°C). Grease and flour two 9-inch round cake pans.
In a large bowl, sift together the flour, baking powder, baking soda, cinnamon, nutmeg, and salt.
In another bowl, beat together the sugar, oil, and eggs until well combined.
Gradually add the dry ingredients to the wet ingredients, mixing until just combined.
Fold in the grated carrots, crushed pineapple, and chopped nuts (if using) until evenly distributed.
Divide the batter evenly between the prepared cake pans and smooth the tops with a spatula.
Bake in the preheated oven for 25-30 minutes, or until a toothpick inserted into the center of the cakes comes out clean.
Allow the cakes to cool in the pans for 10 minutes, then transfer them to wire racks to cool completely.