Function to bin dates