One can use the past perfect with an indication of time. It depends on context and what you want to say.
Such as they stand, and without further context, I would not use the past perfect in either of your sentences.
But one can imagine contexts where the past perfect would be possible.
I had eaten an apple before I went to school, but I was still hungry when I got there/by the time I got there.
I had eaten an apple yesterday morning before I went to school, but I was still hungry when I got there.
In these sentence the past perfect is justified to describe an action (eating an apple) that precedes another action (going to school) in a past context. If nothing in the context specifies that you are talking about a situation in the past then the past perfect is not justified.
It would sound weird to say:
- I had eaten an apple before I went to school but I'm still hungry.
I'd rather use the simple past:
- I ate an apple before I went to school but I'm still hungry.
The past perfect expresses the idea that one action occurred before another action in the past.
Time indication is perfectly acceptable with the past perfect and could be an actual time of course:
- I had eaten an apple at half past seven before I went to school, but I was still hungry when I got there.