Summer is a popular time of year to visit Hammamet and Tunisia but the temperature can really get hot, over 100 degrees F. in mid summer.   Make sure to carry plenty of sunscreen for beach stays and just walking around.
In winter the temperatures are much cooler so you won't be spending any time in the water, but a seaside stroll is good any time of year.   It's much less crowded, but with the cooler weather most of the outdoor cafes and discos will be closed. You'll be spending more of your time indoors.

The best weather for touring is between April and October, although there can always be extreme heat in summer and some rainy days in early spring and fall.