Adjust date/time based on timezone

Not sure it works that way. Based on my reading of the docs and a lot of debug() statements, the controller is called twice. It is called to setup the view, the view is called, and then the controller is called again. Based on my testing, here is the series of events that take place:

  1. Controller edit() function called from a link
  2. The record ID and a usergroup is identified
  3. It is not a patch, post, or put so the save() if logic is ignored
  4. The associated data is identified
  5. The debug() is called and shows the correct time
  6. The timezone is changed which properly adjusts the date/time
  7. The debug() is called and shows the correct date/time in a different timezone
  8. The set()s are called
  9. The View is rendered
  10. The form end() is reached in the view once the Submit is clicked
  11. Control is sent back to the controller edit() function
  12. The record ID and a usergroup is identified again which seems like a total waste of time but that’s how it was Baked
  13. This time through, the request type is a post so it triggers the if statement
  14. The data is retrieved from the view form
  15. The debug is called and shows the incorrect date/time
  16. The save() is called
  17. The user is returned to the index() screen

Based on how it actually works, I’m not sure I understand your comment. When it comes back from the view, it never executes that code at the bottom of the edit() function.