The result that shows in the debug Variables display area looks pretty random to me. When I look at the values, cdate is null, and gdate has a cachedYear of 2004, while the dayOfMonth, Month and Year are all 0. Again, what am I doing wrong?
Verrry innnteresting. Printing the field as you suggested had the same results that you showed, that is, the field changed as it was supposed to.
But the variable display area of the debug mode showed that the field did NOT change.
This tells me that my question is not about making the code work right, but it's really about making the environment work right, so the code will do what it is supposed to do. Or that I need to understand the environment, and how to interpret what debug is telling me. I'll go to the experienced folks around here for that.