1. You are to learn this poem by heart
by Wednesday.
2. I am to learn this poem by heart by
Wednesday. (при условии, что Вы точно собираетесь его учить, иначе I was told to learn this poem by heart by Wednesday)
3. I had to learn this poem by heart by
Wednesday.
4. I will have to learn this poem by
heart by Wednesday.
5. I didn’t have to learn this poem by
heart.