Convert String yyyy-mm-dd to month name

0
I have a string file FECHA EMISION="2018-03-02". To show like "Marzo" I have to convert

$F{FECHA EMISION}.substring(5,7) 

in integer. But I don´t know how convert the result 02 to the month related

 

maycarb's picture
Joined: Jan 24 2019 - 4:02pm
Last seen: 9 months 1 week ago

3 Answers:

0

Hi,

You can do this using a date format. Possible date formats can be found here (for example): https://community.jaspersoft.com/wiki/date-and-time-patterns A pattern can be added to a textfield in the properties of a textield (in the properties find pattern).

Another reference on the use of date patterns can be found here: http://jasperguide.blogspot.com/2014/03/date-and-time-pattern.html

Hope this helps.

Kind regards,

Maarten

 

maarten.doe123's picture
Joined: Aug 22 2017 - 4:41am
Last seen: 4 days 23 hours ago
0

Try the following.

(new SimpleDateFormat("MMMMM", (new Locale("es")))).format((new SimpleDateFormat("yyyy-MM-dd")).parse("2018-03-02"))

hozawa's picture
52532
Joined: Apr 24 2010 - 4:31pm
Last seen: 5 months 1 week ago
0

Thanks.

I try this and works correctly

UPPER(DATEFORMAT(new SimpleDateFormat("yyyy-MM-dd").parse($F{FECHA EMISION}), "MMMMM"))

It shows me MARZO

 

maycarb's picture
Joined: Jan 24 2019 - 4:02pm
Last seen: 9 months 1 week ago
Feedback
randomness