function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Rocio VivancoRocio Vivanco 

How to convert an Event EndDatetime to "dd-mm-yyyy"

Hi all,

unfortunately I couldn't find a solution to this.
I have the following code:
Datetime eventdate = event.EndDateTime;
               String dateOutput = eventdate.format('dd-MM-yyyy');
               event.Subject = 'Visit ' + acc_name + ' ' + eventdate;
Event has a field EndDateTime which is a Date Time type, but what I want is to convert that format to "dd-mm-yyyy".
I can save the event through Apex, but my subject appears as: Visit Test2 2017-05-31 10:00:00 (for example)

My Salesforce application timezone looks like this:

User-added image

In Spain we use to set the date dd/mm/yyyy or dd-mm-yyyy, but we need the application in English because our users require this.
Any idea how to convert the EndDateTime.

I would appreciate any help.