Thanks to your well-ordered and well-presented replies, the problem is now solved. Thank you, Yorman.
I found the problem. I had changed date($d) to time($d) because date($d) does not account for daylight saving time.
I have just changed it back to date($d). Now, unfortunately, the problem of the daylight saving time is back again. The site now shows the time to be an hour earlier than it actually is.
You’re right about the ‘time()’ function, Yorman. Thanks. This code was already part of the WP theme. The mystery is that it has worked correctly for years, and only now has malfunctioned.
Thanks for your help and the references. I can fix the problem now.