If you always set DateFormat before you use it, without any other changes to it in-between where you set it and where you use it, then you don't have to do the save and revert. And a trap with save-and-revert is that there are often ways for program flow to escape before the revert eg if an exception occurs, or you have a break or a return in-between.
On the other hand, from a defensive programming perspective, it's also a good habit to leave things as you found them, just in case.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.