Format date function changes the time

Where do you apply this formatting to exactly?
Also - have you tried the solution from here: Edit Calendar Event ?