/*********************Pay Button Listener***************************************/
	public class payListener implements ActionListener{
		public void actionPerformed(ActionEvent e) {
			
			replace();
			Ticket getNewPayTime = new Ticket();
			getNewPayTime.loadTicket(ticketIDNumber);
			paymentTime = Ticket.paymentTime; //getting correct ticket pyament time, correction performed by replace method. 
			
			long timeDifference = paymentTime - entranceTime;
			
			SimpleDateFormat sdf1 = new SimpleDateFormat("MMM dd,yyyy HH:mm");
			Date paymentdate = new Date (paymentTime);
			lPaymentTime.setText("Payment Time: " + sdf1.format(paymentdate));
			SimpleDateFormat sdf2 = new SimpleDateFormat("HH:mm");
			Date resultdate = new Date(timeDifference); 
			lTimeDifference.setText("Duration: " + sdf2.format(resultdate));
			
			
			
			
			}
		}
	/*********************Pay Button Listener***************************************/

in the line

SimpleDateFormat sdf2 = new SimpleDateFormat("HH:mm");

how do i print time in hh:mm:ss format?

also my duration isnt correct, showing hours when there are no hours passed and its just minutes?

What is the value of timeDifference and what displays for the formatted date?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.