I’d like to print a formatted time (clientside), I’m using the following:
import java.util.Date;
...
Date date = new Date();
DateTimeFormat.getFormat(PredefinedFormat.DATE_SHORT).format(date)
This prints something in my browser like:
14:13
I’d like this to respect my current locale (en_US). I’m not sure why it’s printing in 24-hour format, thought using the current locale would be the default behavior. Do we have to do something special to get the formatter to use the current locale? (trying this on mobile safari and latest version of firefox),
Thanks
You need to specify the locale in either a meta-tag, or in a query string:
https://developers.google.com/web-toolkit/doc/latest/DevGuideI18nLocale#LocaleSpecifying