Date Time additions/parsing

C

Carla

Hi,
I have a GUI which has a departure date field (text), departure time
field (text), and once the user enters information about these, I have
to add the estimated time of journey to the departure date-time to
calculate arrival date-time.

Can someone help me, please?

I am getting the date from the departure date field in the following
manner.

String str_date = departdateField.getText();
DateFormat formatter;
Date date;
formatter = new SimpleDateFormat("dd-MMM-yy");
date = (Date) formatter.parse(str_date);
System.out.println("Today is " + date);
 
A

Arne Vajhøj

Eric said:
Calendar cal = Calendar.getInstance();
cal.setTime(depart);
cal.add(Calendar.MINUTE, journeyHours * 60 + journeyMinutes);
if (destination == Airport.CHICAGO_OHARE)
cal.add(Calendar.MINUTE, 2 * 60 + 30); // congestion

:)

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,260
Messages
2,571,039
Members
48,768
Latest member
first4landlord

Latest Threads

Top