|We don't usually answer homework questions in this formula - unless the poster has given it a try and can't come up with a working solution.|
Since you've posted what you tried, we're willing to help.
Excel dates and times are stored internally as numbers, with the Integer portion of the number being the date, and the Decimal portion being the time.
Each integer represents 1 day, starting at 1/1/1900 on most systems.
If you enter a date (and time) in a cell and format it as a number, you'll see how many days (and fraction of a day) that date is from 1/1/1900
Now, since each integer is 1 day, if you subtract 1 date from another, you'll get the number of days. Divide that result by 7 and you get the number of weeks.
With your dates in A2 and B2...
=(B2-A2)/7 = 34.71428571
(40057.00 - 39814.00)/7 = 34.71428571
I hope that helps!