I'm currently running a batch Apex job every day that processes payments for all Opportunities due to close on a given day. This is working fine, but we are soon expanding into other timezones, and I'm not sure how it will work.
I want to run a SOQL query for all Opportunities closing today, but "today" is different in the US and Australia (the two countries we are operating in). My user account is based in Australia, so currently it will pick up Opportunities one day early, which will be incorrect.
The CloseDate field is a Date rather than a DateTime, meaning it has no timezone. I guess this means that whether or not an Opportunity closes "today" depends on the user's timezone -- correct?
If that's the case, is it possible to modify this behaviour in Apex? I guess I could run the batch job under a user in the right timezone, but I don't really want to have to do that.
Thanks!
Matt