It is 3.30pm, and the first workers begin to trickle out of the curved glass headquarters of the Stockholm IT giant Ericsson.

John Langared, a 30-year-old programmer, is hurrying to pick up his daughter from school. He has her at home every other week, so tends to alternate short hours one week with long hours the next.

Sai Kumar, originally from India, is leaving to pick up his daughter because his wife has a Swedish class. Ylva (who doesn’t want to give her surname) is “off to the gym to stay sane”, as is Sumeia Assenai, 30, who came in at 7am, so is allowed to leave early under her company’s “flex bank” system.

I handle my time any way I want. They just rely on me to do the work John Langared

Minutes after 4pm, the trickle turns into a stream of people tramping through the tunnel under the E4 motorway out of Stockholm’s tech district. The local traffic authorities mark the start of the city’s rush hour at 3pm, the time the first parents begin to leave work to pick up their children from school and kindergarten, and mark its end at past 6pm.

Sweden’s flexible approach to working hours is one reason it was ranked best in the world for work-life balance in a recent HSBC survey. Only about 1.1% of the nation’s employees work very long hours, according to the OECD’s How’s Life survey, the second lowest share among the organisation’s 38 countries.

Above all, it seems to have found an answer to a question that has vexed parents across the world for years: what do you do if school finishes at 3pm and work at 5pm?

Q&A When Europe gets it right Show As a series of crises puts Europe under strain, some cities are fighting back with innovative solutions. From hyper-specialist shops beating the online threat in Berlin to the Bulgarian city reversing the country's brain drain, from the Italian city finding new ways to tackle addiction to gambling to the Swedish town that has found innovative ways to combat extremism, we look at what European cities are doing to live better in our increasingly urban world.

Langared says his colleagues and managers never make any comments on the days he leaves his desk shortly after 3pm: “They’re totally OK with it. Basically, I handle my time any way I want. They just rely on me to do the work, but which hours I do it in, it’s up to me.”

If his daughter is ill, he sends an email in the morning saying he needs to vab, the Swedish term for taking a day off to look after a sick child, although now she is a bit older he often works from home.

According to Fredrik Lindstål, the city’s vice mayor for labour, the flexibility that Stockholm’s employers offer helps the city attract the highly educated workers its tech industries need. “The city is actively marketing Stockholm as a destination for starting a family while maintaining a high-level career,” he says. “They’ve been really good at promoting this as a go-to factor.”

Robin Bagger-Sjöbäck, who works at Carnegie, Sweden’s leading investment bank, is one of those who’ve been attracted, or at least attracted back.

The city’s rush hour officially starts at 3pm as parents begin to leave work to pick up their children from school and kindergarten. Photograph: Christian Science Monitor/Getty Images

He returned to Stockholm in 2014 after three years working 12- to 14-hour days at the French bank Crédit Agricole in London. Such moves are common among Scandinavian investment bankers, he says.

“A lot of Nordic people start leaving London when they reach 30 and it comes to marriage and, sooner or later, kids,” he says. “A lot of people I knew have left London and now have families, either here in Stockholm, or in Copenhagen or Oslo.”

He now drops off his son most days (often, he says, while simultaneously taking part in a conference call). And although he still occasionally puts in extremely long hours when completing transactions, he is sceptical of the hours that are common in London or New York.

“I think that if you work those 18-hour days and 80- or 90-hour weeks, in the long run you’re not getting that much more out of it,” he says. “Those last five or six hours a day, I think they’re just marginal. I don’t think the brain works that well if you do that for a longer period of time.”

Johanna Lundin, chief executive of Equalate, which advises companies on promoting gender equality, says Stockholm’s work-life balance is rooted in Sweden’s 50-year push for equal treatment of men and women. “Creating a social norm where both men and women take an equal role in childcare is a very important element,” she says. “This enables women to make and have a career, and it allows men to take part in their children’s lives.”

Most companies in Stockholm allow workers to do flexible hours, only requiring them to be in the office between 9am and 4pm, or sometimes 10am and 3pm. Under Swedish law, employees have the right to take the day off to look after a sick child, with the state reimbursing them for 80% of any salary lost.

But perhaps the most important element is the system of parental leave, with a generous 480 days of paid leave granted for each child – almost two years of working days in total – which can be shared as the parents wish. To encourage men to take more leave, there are three so-called daddy months, which can only be used by one partner and are lost if not taken.

Bagger-Sjöbäck spent two months at home looking after his daughter, and says other male bankers at Carnegie have taken five to six months without doing any damage to their careers. “I have a colleague who was away for the whole fall, I guess five months,” he says. “He is well respected at the firm, both before and after, and as far as I know no one has mentioned anything.”

About 100 of the 300 staff at the bank’s Stockholm office have taken some parental leave over the last three years, 60 of whom were men. This is not to say, however, that combining a challenging career with small children is easy, even in Stockholm.

Martin Vogel and his children in Södermalm. Photograph: Richard Orange

“It’s hard when you have one child in school and the other in daycare,” admits Martin Vogel, stage manager at Stockholm’s Royal Dramatic Theatre, as he walks with his two children past a school in the fashionable district of Södermalm at 7.45am.

“It’s a battle, it’s a constant battle,” groans Jakob Lagander, COO of the Nordic IT company Pedab, as he rushes from the school to the nearest underground station. Lagander’s wife is a banker, and he says it is not really socially acceptable in Stockholm to employ a nanny, as a similarly high-earning couple would in London.

But he says employers in Sweden are also much more understanding of the challenges of being a parent than they are in Dublin, where he spent three years working for the US IT company IBM. “I didn’t feel that parents could leave before 4pm in Dublin,” he says. “I get the feeling that it’s much more relaxed here.”

But, he adds, Swedish executives do somehow manage to get at least the same amount of work done, with much less time spent chatting or messing around with colleagues. Indeed, one of the main complaints of British people working in Sweden is the lack of office banter and the rarity of after-work socialising.

“I think we are much more efficient during the day,” Lagander says. “There’s so much more lazing around, especially in the United States. They put in a lot of work hours, but they’re so inefficient.”

Follow Guardian Cities on Twitter, Facebook and Instagram to join the discussion, catch up on our best stories or sign up for our weekly newsletter