What is the difference between publishing and setting its availability (by date)?

If an item is unpublished, it will not be visible to students, regardless of availability dates. 

The available from (or lock until) and until dates (for Assignments and Quizzes) control when a student can submit to a published item.