maycarb Posted January 29, 2019 Share Posted January 29, 2019 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 Link to comment Share on other sites More sharing options...
mtn Posted January 29, 2019 Share Posted January 29, 2019 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.htmlHope this helps.Kind regards,Maarten Link to comment Share on other sites More sharing options...
hozawa Posted January 29, 2019 Share Posted January 29, 2019 Try the following.(new SimpleDateFormat("MMMMM", (new Locale("es")))).format((new SimpleDateFormat("yyyy-MM-dd")).parse("2018-03-02")) Link to comment Share on other sites More sharing options...
maycarb Posted January 30, 2019 Author Share Posted January 30, 2019 Thanks.I try this and works correctlyUPPER(DATEFORMAT(new SimpleDateFormat("yyyy-MM-dd").parse($F{FECHA EMISION}), "MMMMM"))It shows me MARZO Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now