njengert Posted November 30, 2015 Posted November 30, 2015 I work for a public library, and when someone checksout a book, we give them a reciept with a Due date, using $F{Item_Due_Date} which is a string.However, this printed out 12-31-15 00:00AMTo fix this, I used $F{Item_Due_Date}.substring(0,8)It then would print 12-31-15This is perfect! With the excpetion of one thing. Laptops/headphones...Which are limited to 2 hours. And since I removed the time part, the receipt just gives the whole day. Therefore, someone may not remember when they are due back.In short of having the librarian writting the time on the reciept is there a way to fix this? Something like if due_date doesn't end in 0's print it out?Thank you for your help!
Solution hozawa Posted November 30, 2015 Solution Posted November 30, 2015 Do something like below:"00:00".equals(string.substring(string.length() - 5)) ?$F{Item_Due_Date}.substring(0,8) : $F{Item_Due_Date}
njengert Posted December 3, 2015 Author Posted December 3, 2015 Thanks for your help Hozawa!This is the formula I ended up using:$F{Item_Due_Date}.substring(9,16).equals("00:00AM")?$F{Item_Due_Date}.substring(0,8):$F{Item_Due_Date}
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