dcseain: Cast shot of me playing my violin in role of minstrel in the Two Gentlemen of Verona (Default)
dcseain ([personal profile] dcseain) wrote2006-06-08 07:29 pm

JVM Help

Fellow geeks, I have a user with a query, and i'm having trouble finding the answer. I need a java VM switch, likely a -Duser.x that will allow one to tell a VM to use 24-Hour time format instead of defualt for English(United States), and a switch to overide the default date setting also; both to suppress the date, and to change the date format. The closest i've found so far is -Duser.timezone=GMT(+\-)n. That's fine and well, but timezone is not the issue, but rather date/time format. Suggestions?

[identity profile] madbodger.livejournal.com 2006-06-09 04:29 am (UTC)(link)

Check it out.
(http://javatechniques.com/public/java/docs/basics/dateformat-examples.html)

[identity profile] dcseain.livejournal.com 2006-06-09 02:16 pm (UTC)(link)
Yeah, i've found that, but that's programatically. Eventually, i might convince Program Management to put date/time format configurability into the client, but until then, I need to be able to set this in the Java Client as a start-up switch.

For example:

-Xmx256m "-Xloggc:C:\\App\logs\fsgc.log" -Duser.timeformat="HH:mm:ss"

except that -Duser.timeformat is not a valid switch. I've found 3rd-party apps that do that, but that's not helpful either.

Can you switch the Locale()?

[identity profile] blackfeather.livejournal.com 2006-06-20 09:33 pm (UTC)(link)
If so, then there are several Locale settings which will give a default 24 hour clock (and for long formats, still use English). I've written two really small classes, one of which will print out all System properties, and another which will show the different locales and a Date formatted to that locale. To set the locale right it seems you need to use -D flag to set both user.language and user.country . From what I can see en_GB will use the 24 hour clock.

If you want the small sample classes, I can mail you those, too.

Sorry it took a while (12 days), but I got the idea here after I was reading about the System class. Hopefully this is still useful! :-)

-- Helgi / Craig

Re: Can you switch the Locale()?

[identity profile] dcseain.livejournal.com 2006-06-20 09:38 pm (UTC)(link)
This is true, but en_GB will also sub £ for $, as well as alter date format and spellings for a number of words.