Expressing duration with "le"
Saying how long you did something for in Chinese can seem tricky, as there is no preposition as in English. Instead it's all about word order:
Subject + Verb + 了 + Duration + Object
So 了 is placed after the verb (to indicate that the action is completed), followed by the duration. This is how you talk about the duration of completed actions.
- 他 在 北京 住 了 两 年。
- 我 上 了 半 个 小时 网。
- 我 做 了 三 个 小时 作业。
Note that the pattern above can be used to express the duration of completed actions which are no longer in progress, although strictly speaking, it's not entirely clear if the actions are still ongoing or not. To indicate that the actions are definitely completed, a time word may be inserted into the sentence to indicate that you're talking about an event in the past:
Subject + Time Word + Verb + 了 + Duration + Object
- 他 以前 在 北京 住 了 两 年。
- 我 昨天 上 了 半 个 小时 网。
- 我 上个 星期 做 了 三 个 小时 作业。
To indicate that the action is definitely still in progress, use a slightly different pattern.