For a given town I search a javascript that gives the hour of the sunset and
the sunrise.
Looks simple but not found up to now on the net
No, it's nothing close to simple.
That's meteorological data that changes daily and would not be quite the same
over years. If you actually had all that data in a database, you'd still need
a server-side script to retrieve it (not client-side javascript).
I'd look into a web service from a national agency that keeps track of these
things or some other provider. My guess is that's where such data would
normally come from (i.e. Excite.com's section that has such data). I would
not attempt to keep such data in a DB myself unless the towns I kept track of
numbered less than 10. Even then I'd probably go find it somewhere else.
That'd be hell to keep updated.
For example:
http://ws2.serviceobjects.net/fw/FastWeather.asmx?op=GetWeatherByCityState
--