Quite recently, I faced an issue wherein I have to push some calculated date(based on some algo) to the date field on EditView of a custom module.
My custom function calculated date in dd/mm/yyyy format but the user can have any possible date formats defined by SugarCRM.
Before pushing my calculated date i need to format this date according to user’s settings.
I came through this intelligent post from Johndope http://johndopenotes.wordpress.com/2013/03/05/sugarcrm-format-date-according-to-user-timezone/.
I did little modifications in the code and hurray it solved my problem.