Problem with NSTimestamp
"koteswararao mogili" <[email protected]>
| Newsgroups | gmane.comp.web.webobjects.eof,gmane.comp.web.webobjects.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi,
I have got a strange problem with NSTimestamp . When year is 1900 , the hour
is getting reduced by 1 after parsing with SimpleDateFormat. The problem is
not observed with Calendar.
Please find the code below.
Any suggestion or help is greatly appreciated..
--Rao
import java.text.*;
import com.webobjects.foundation.*;
import java.util.*;
public class DateTest {
public static void main( String args[]) {
NSTimeZone tz = NSTimeZone.localTimeZone();
NSTimestamp myNSTimestamp = new NSTimestamp(1900, 02,23, 10, 50,47, tz);
/*Calendar rightNow = Calendar.getInstance();
rightNow .set(1900, 02,23, 11, 50,47);*/
SimpleDateFormat tErrorDateFormat = new SimpleDateFormat("HH");
String strTmp = tErrorDateFormat.format(myNSTimestamp);
System.out.println("Hour is ...."+new Integer(strTmp)+" "+myNSTimestamp);
}
}
_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail