Dim with the sun

I have a GE dimmer switch that I would like to dim from min to max and then back to min based on the sunset time.
Can anyone point me to some example code that I can look at and extend to achieve this (just need the code to change the dimmer value)?

The final goal is to go from min brightness at sunset to max brightness in an hour, or so, and then go from max brightness at 9pm to switch off at say 11pm.