Hard to say. I cannot think of a very formal situation in which you might use either, really (in which I would use, perhaps, 'for a considerable length of time'), but plenty of written English is comfortable with those phrases, certainly.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.