I'm using a DateTime SWT component, and it has an American format when displayed (mm/dd/yyyy).
Is there any way to change the format to dd/mm/yyyy ?
I'm using a DateTime SWT component, and it has an American format when displayed (mm/dd/yyyy).
Is there any way to change the format to dd/mm/yyyy ?
DateTime
uses the OS specific user preferences to format the date. (On Windows these are the Regional and Language Options in the system settings).
A possible workaround is described here (scroll down to the latest two entries). But I haven't tried this myself.
You need to set the locale to change the date format, e.g. to Italy who use dd/mm/yyyy:
Locale.setDefault(Locale.ITALY);
An alternative is the Nebula CDateTime Widget: https://www.eclipse.org/nebula/widgets/cdatetime/cdatetime.php
(btw: if you are using Linux there is a bug regarding the locale: https://bugs.eclipse.org/bugs/show_bug.cgi?id=248075)