Just how long does it take to develop a habit. Many people I know would say about three weeks. I say it depends. First and foremost it depends on your original motivation.
For example, let's say your goal is short term - lose a few pounds so you can look great in a swim suit before you take that winter vacation on the beach next month. You can probably do that. Let's say it takes you three weeks to drop five or six pounds. Did you develop a new habit? Maybe. Maybe not. We won't know until a few months later when we learn if you KEPT that five pounds from coming back.
Now, let's say your goal was long term - you want to feel better for the rest of your life. Will it still take just twenty-one days? Maybe. Maybe not! Depends on what you do in those first three weeks. A change of diet and exercise involves dozens of daily conscious decisions. It might take weeks before you see real results. Seeing results enforces the motivation. Not seeing results may discourage you to the point you give up before the new routine is a habit.
I still like this poster from fitsugar. Habit is what keeps you going. My advice is to that you need the correct motivation - a long term lifestyle change.
Be sure to eat some breakfast, and take a Clif Bar with you.