Well, your second sentence should be in the past tense:
'Two days ago, he worked for more than eight hours.'
Your first sentence, which is in the past perfect progressive/continuous tense, is grammatically correct.
However, you need some context to use it.
I hope my response will be of some help to you.
Student or Learner