I am running my Java app on a Windows 7 machine where my regional settings are set up to format dates as YYYY-mm-dd and time as HH:mm:ss (e.g. \"2011-06-20 07:50:28\"). But
I looks like you will need to access the Windows registry for this. See this question for various solutions to that read/write to Windows Registry using Java.
Once you choose one of the many methods of accessing the registry you will need to get the correct key from the registry for the format. This document indicates the key to use is HKEY_USERS\.Default\Control Panel\International
.
When using GNOME in Linux, you can use the gconftool
command similar to the reg
command for Windows as mentioned in the prior links about the Windows registry. I see the key /apps/panel/applets/clock_screen0/prefs/custom_format
in my configuration, though it is blank since I am using the default:
gconftool -g /apps/panel/applets/clock_screen0/prefs/custom_format
I'm not sure if that is the value you'd want to use for your purposes or not.
On Mac OS, I'm not sure what you would do.