33 days
The basic rules give a list of XP per level. The DMG gives a list of XP per adventuring day per level. All you need to do is compare those numbers to figure out the number of days it takes for each level.
For example at 4th level you need 7500 to level up, and your daily xp budget is 3500 xp. 7500 / 3500 = 2.1, so it takes a little over 2 days to level up.
Then you can sum up all those numbers, which gives a total of 33.4 days.
Level |
XP to Level Up1 |
XP per Day2 |
Days to Level Up3 |
1st |
300 |
300 |
1 |
2nd |
600 |
600 |
1 |
3rd |
1800 |
1200 |
1.5 |
4th |
3800 |
1700 |
2.2 |
5th |
7500 |
3500 |
2.1 |
6th |
9000 |
4000 |
2.3 |
7th |
11000 |
5000 |
2.2 |
8th |
14000 |
6000 |
2.3 |
9th |
16000 |
7500 |
2.1 |
10th |
21000 |
9000 |
2.3 |
11th |
15000 |
10500 |
1.4 |
12th |
20000 |
11500 |
1.7 |
13th |
20000 |
13500 |
1.5 |
14th |
25000 |
15000 |
1.7 |
15th |
30000 |
18000 |
1.7 |
16th |
30000 |
20000 |
1.5 |
17th |
40000 |
25000 |
1.6 |
18th |
40000 |
27000 |
1.5 |
19th |
50000 |
30000 |
1.7 |
1. XP to level up is calculated from the Basic Rules Character Advancement table by subtracting the XP to reach a level from the XP to reach the previous level.
2. XP per day is lifted straight from the Dungeon Master's Guide Adventuring Day XP table.
3. Days to level up is calculated by dividing the XP to level up by XP per day.
Level up during the day? Splitting XP budgets?
You will notice that a lot of days have a decimal portion. If you're willing to run half of a day using the 3rd level budget, level up, then run the remaining half of the day with the 4th level budget, then 33.4 days is the result you will get.
You could also end the day as soon as characters have enough XP to level up, in which case it would take 43 days. However I don't know of any rules saying you need to do this.
The choice that I would probably consider closest to RAW (and perhaps sanest) is to set the XP budget at the start of the day and not modify it even if the PC levels up. If you do so then you'll need 34.6 days to hit level 20.
How long in real life?
As a side note, I would estimate that most sessions I played only get through 2-3 encounters per 3-4 hour session. This may show I play relatively low combat games, but it's interesting to think that this means it would take approximately 160-340 sessions to play an entire 1-through-20 campaign. At 1 session per week, that's 3-6 years.