[threeten-dev] How to get pattern as a String from DateTimeFormatter
Roger Riggs
Roger.Riggs at Oracle.com
Mon Mar 2 23:05:38 UTC 2015
Hi,
Take a look at
java.time.DateTimeFormatterBuilder.getLocalizedDateTimePattern.
It may provide the components you need.
http://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatterBuilder.html#getLocalizedDateTimePattern-java.time.format.FormatStyle-java.time.format.FormatStyle-java.time.chrono.Chronology-java.util.Locale-
Roger
On 3/2/2015 5:13 PM, Rodrigo Uchôa wrote:
> Interesting.
>
> My problem is, I need to the "FormatStyle.SHORT" pattern as a String from a
> specified locale at runtime. Is there any other way?
>
> On Mon, Mar 2, 2015 at 4:38 PM, Stephen Colebourne <scolebourne at joda.org>
> wrote:
>
>> The pattern is not retained, so this cannot be done.
>> Stephen
>>
>> On 2 March 2015 at 18:50, Rodrigo Uchôa <rodrigo.uchoa at gmail.com> wrote:
>>> After building an instance of DateTimeFormatter, is it possible to
>> extract
>>> from it the pattern as a String?
>>>
>>> Something like this:
>>>
>>> DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy");
>>> String pattern = formatter.toPattern(); //example
>>>
>>> Is there any way this can done?
>>>
>>> Regards!
More information about the threeten-dev
mailing list