Change SWT DateTime format

I am using the SWT DateTime component and it is displayed in American format (mm / dd / yyyy).

Is there a way to change the format to dd / mm / yyyy?

+5
source share
2 answers

DateTime uses the user's OS settings to format the date. (On Windows, these are regional and language settings in the system settings).

A possible workaround is described here (scroll down to the last two entries). But I have not tried this myself.

+2
source

You need to set the locale to change the date format, for example. to Italy who uses dd / mm / yyyy :

 Locale.setDefault(Locale.ITALY); 

An alternative is the CDateTime Widget Nebula: https://www.eclipse.org/nebula/widgets/cdatetime/cdatetime.php

(btw: if you are using Linux, there is an error regarding the locale: https://bugs.eclipse.org/bugs/show_bug.cgi?id=248075 )

+1
source

Source: https://habr.com/ru/post/1239989/


All Articles