TimeStamp

Hi there,I am haveing some problems in compareing a timestamp with adding some hours to it .I am trying to get the current time in which 10 hours are subtracted or added. Any idea ?
[223 byte] By [amgandhi] at [2007-9-26 1:46:37]
# 1
show me the problematic code and also tell me what exactly is the problem u r facing
shaghab at 2007-6-29 2:44:37 > top of Java-index,Archived Forums,Java Programming...
# 2

To manipulate dates (and times) you should use the Calendar class:

// calendar set to current date and time

Calendar cal = Calendar.getInstance();

// Add ten hours to the current date/time

cal.add(Calendar.HOUR, 10);

// Get back the date in the calendar so we

// can pass it around our application

Date date = calendar.getTime();

// Print if, for example

SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss");

System.out.println(format.format(date));

Hope this helps.

KPSeal at 2007-6-29 2:44:37 > top of Java-index,Archived Forums,Java Programming...
# 3
Thanks Kevin , It worked .Could you tell me how to transfer the duke dollars .
amgandhi at 2007-6-29 2:44:38 > top of Java-index,Archived Forums,Java Programming...