carlospc Member Licensed User Longtime User Aug 22, 2025 #1 Hello. I was reading that I had to save the current value of DateFormat, change it, do some code related to the date, and the revert it back. Was I reading right? I thought that I could set the DateFormat in Starter and forget it.
Hello. I was reading that I had to save the current value of DateFormat, change it, do some code related to the date, and the revert it back. Was I reading right? I thought that I could set the DateFormat in Starter and forget it.
DonManfred Expert Licensed User Longtime User Aug 22, 2025 #2 carlospc said: Was I reading right? Click to expand... Yes carlospc said: I thought that I could set the DateFormat in Starter and forget it. Click to expand... Bad idea Upvote 0
carlospc said: Was I reading right? Click to expand... Yes carlospc said: I thought that I could set the DateFormat in Starter and forget it. Click to expand... Bad idea
E emexes Expert Licensed User Longtime User Aug 22, 2025 #3 carlospc said: I was reading that I had to save the current value of DateFormat, change it, do some code related to the date, and then revert it back. Click to expand... 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. Upvote 0
carlospc said: I was reading that I had to save the current value of DateFormat, change it, do some code related to the date, and then revert it back. Click to expand... 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.