Over one hundred years ago, every city in the world set its own time based on when was thought to be noon - when the sun was at its highest in the sky, from said city.
Neighbouring cities set their clocks differently to make this work. For example, if it were 6:00PM in New York City , it would be 6:12PM in Boston , because Boston is about 3 degrees east of New York City.
This small difference in time between neighbouring cities didn't matter too much, until that was the World became far more modern with both communication and transport links.
This prompted Canadian Sir Sandford Fleming, renowned railway planner and engineer to think of the idea of time zones in the late 1870s. And thus these were developed and used them for the first time in 1883.
At an International conference in Washington, D.C. in 1884 the World time zones were determined. The world, with 24 hours in a day, was divided into 24 time zones. Each one a long strip from North Pole to South Pole, about 15 degrees of longitude wide and about one hour difference in time.
Today, this time zone system is in use in most countries around the world, with only a few places setting their closet 15 or 30 minutes different from the time according to the standardized time zone system