I'm trying to set up a Balance Sheet for our company and I am using the following date string to try and get the fiscal period ending date:

=DATESTRING(ADGETF("gldates.END",FPRIOR(0)),"As of %B %d, %Y")

I have gone into the reporter under the Date of July 31/07 (the date I am working on) but the date that is generated by the above string is June 30/07. I have checked all my fiscal periods in the company profile and they are all correct. I opened an older balance sheet that used this code and the date comes up correct in that statement. So I then tried to copy and paste from one to the other an although it is the exact same code, one comes up June and the other July????? Please help!