in reply to optimize the code

Reducing the amount of work done inside the loop can help.

Are all the timezones the same? If so you could calculate/build a string for three days ago outside the loop.

If there are different timezones you could use a hash to cache each one so that you only carry out the costly calculation once for each timezone encountered.

Are they fixed width fields/records? If so you could use substr to just test that part of the record i.e. dd/mmm/yyyy and possibly +0000.