Imagine a weekend, a week or even a month without your iPhone, computer or any other devices. Chances are you’re not going to work, at least not in the same capacity. You might go far away from home, to take in views of old growth forests or coastal sunsets. You might even pay for a retreat meant to make people disconnect, distracting them from the loss of their phones with nostalgic camp games, face painting and vegan food.

That doesn’t sound too hard. But returning to a mountain of email and miles of missed social media might jumpstart your old habits. A digital detox won’t, on its own, fix an obsessive relationship with technology, said Dr. Larry Rosen, a California State University, Dominguez Hills, psychology professor and former department chair who has studied people's attachment to their phones. You'll have to make a concerted effort to change your behavior once you return to your devices.

Compulsive clicking, posting and checking doesn’t give us pleasure, Rosen said. It’s based on a need to get rid of neurotransmitters that signal stress or anxiety, like cortisol. “People are acting more out of the need to not be left out, the need to respond immediately, and they’re doing it not because it makes them feel good, but because they have to,” he said. “And if they don’t do it, they get stressed.”

Instagram users spend an average of 21 minutes on the app each day, Mark Zuckerberg said during a Facebook earnings call this week. A study last year showed that smartphone users check Facebook on their phones an average of 14 times a day. And Locket, an app that pays Android users to display ads on their locked screens, says its users unlock their phones more than 100 times a day on average.

Rosen and colleagues have demonstrated that taking people’s phones away can actually result in separation anxiety. And we’re so used to distracting ourselves with clicks and likes that most men would rather give themselves electric shocks than be left alone with their thoughts, a recent study published in Science found.

These stress-based habits can’t be cleansed away, but some people who have done digital detoxes have successfully changed their relationships to their devices after they've finished. Others have been able to make incremental shifts without completely unplugging.

Travis Cody, a Los Angeles-based best-selling author who worked in Hollywood for a decade, found himself stressed out and miserable in what he thought would be the job of his dreams. He first noticed his productivity went up when he turned off his cell phone ringer so he wasn’t hearing Facebook notifications, emails and texts pinging all day. He started wondering what would happen if he turned everything off, and decided to try it when he had a six-week stretch with no deadlines ahead of him.

Cody turned all of his devices off at midnight one Friday. The following Monday, he went out to dinner with friends, who immediately noticed something was different about him.

“They were just kind of looking at me, and after a minute, they were like, ‘Dude, what’s going on with you?’ Their exact words were, ‘Your energy is just so zen, man.’”

Cody was able to remain unplugged for 30 days, writing by hand and communicating only in person or through a land line. He found he could get his work done so efficiently that he had plenty of time to walk around outside and look at the ocean.

Reentry into the real world was brutal. “A tsunami of distraction just crushed me,” Cody said. “The first couple weeks were not pretty. My shoulders and body hurt, I got chronic headaches, I had no energy. I was like, this is ridiculous.”

Cody, who’s working on a documentary about the experience called “30 Days Unplugged,” needed about six months to work out a system that keeps his digital distraction and anxiety at bay. Most mornings he doesn’t turn on his phone for the first two or three hours after he wakes up, using the time to go to the gym, meditate or read and write. He’s pulled Facebook and email off of his phone. And he sets aside specific windows of time for reading and answering emails — a strategy that works for him but isn’t realistic for workers who feel they must respond to emails as soon as they hit their inboxes.

“Right now, we’ve fallen into this trap where we must respond immediately," said Rosen.

Some companies are standardizing expected response times or limiting email on the weekends. But employees can do their part, Rosen said, by setting automatic replies telling colleagues how they can be reached offline, limiting email use before bed and setting goals of email-free focus time.

Jodi B. Katzman, director at JBK Productions, an events management and production firm, found herself in the midst of an involuntary digital detox a few weeks ago when her phone and computer crashed and her TV stopped working at the same time. She ended up using the downtime to reconnect with herself, old friends and the outside world. Now, she says, she can leave unread emails sitting in her inbox without feeling the urge to open them.

“Anytime I saw those bold emails that hadn’t been read, I used to get a little stressed,” Katzman said. “Now I don’t. No one imposed those restrictions on me. I imposed them on myself.”

A detox doesn’t have to mean a break from all your devices. Arianna Huffington, editor in chief of The Huffington Post, encourages people to do what they can.

“It's important not to make the perfect the enemy of the good,” she said. “Any starting point is good: no devices at dinner, no devices by your bed while you are asleep, and then gradually graduating to a day of digital detox or a week and then digital detoxes while on vacation.”

Disconnecting in some way on a regular basis is important because you need to “let your brain nap,” Matt Richtel, a Pulitzer Prize-winning journalist for The New York Times and author of “A Deadly Wandering: A Tale Of Tragedy And Redemption In The Age Of Inattention,” told New York magazine in a recent interview. Richtel tries to ignore his phone on weekends but can’t always fight the urge to check it.

“I play a lot of tennis, and someone’s going to text me since there’s no other way to communicate — no landlines anymore,” he told the magazine. “Once you’re drinking the beer, why not have a cigarette? All of sudden I’m checking my email, my Amazon numbers.”

Richtel added that he turns off his phone when his kids are around to avoid temptation, and because he wants to set an example for them.

Setting personal rules and boundaries around when and how we use technology is key to breaking bad habits, Rosen said.