private String buildTransaction() { String transaction = ""; DateFormat dateFormat; for (Item i : order.getOrder()) { dateFormat = new SimpleDateFormat("YYMMddHHmmss"); transaction += dateFormat.format(this.transDate) + ", "; transaction += i.getBook().getId() + ", " + i.getBook().getTitle() + ", " + i.getBook().getPriceStr(); transaction += ", " + i.getQuantity() + ", " + i.getPercentStr() + ", " + i.getTotalStr() + ", "; dateFormat = new SimpleDateFormat("dd/MM/YY HH:mm:ss z"); transaction += dateFormat.format(this.transDate) + newLine; } return transaction; }