Jump to content

remove .substring on certain scenarios.


Go to solution Solved by hozawa,

Recommended Posts

Posted

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:00AM

To fix this, I used $F{Item_Due_Date}.substring(0,8)
It then would print 12-31-15

This 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!


 

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted

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}

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...