/*********************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?

Recommended Answers

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

Jump to Post

All 2 Replies

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 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.