Again, a quick glance at the Java API documentation will answer this question as well.
MONTH public static final int MONTH Field number for get and set indicating the month. This is a calendar-specific value. The first month of the year is JANUARY which is 0; the last depends on the number of months in a year.
See Also: JANUARY, FEBRUARY, MARCH, APRIL, MAY, JUNE, JULY, AUGUST, SEPTEMBER, OCTOBER, NOVEMBER, DECEMBER, UNDECIMBER, Constant Field Values
Notice that JANUARY = 0 not 1. The above documentation was pulled right out of the docs for GregorianCalendar class. On Mar 9, 2006, at 11:16 AM, Jim Wong wrote: apologies. i tried the GregorianCalendar actually but seem to keep getting the wrong date. okay...
my code is as follows: GregorianCalendar myCalendar=new GregorianCalendar(); String s=myCalendar.getTime().toString(); int year = myCalendar.get(GregorianCalendar.YEAR); int month = myCalendar.get(GregorianCalendar.MONTH); int date = myCalendar.get(GregorianCalendar.DATE);
System.out.println("Now: "+year+"-"+month+"-"+date);
the year and date is returns the correct value. But for month, it returns february instead of march. can anyone enlighten me on this? On 09 Mar 2006, at 11:44 PM, Mark Morris wrote: Is this actually a test to determine just how accommodating the readers of this list are?
Honestly, Jim, you'll get better a better response in the long term if you take some time to try and solve the easy ones yourself, either using the supplied documentation or searching the list archives. If your project is under such a tight deadline that doing some research yourself is impossible, I know that there are people on this list who will (for a fee, of course) build a professional WebObjects application for you, and give you a good starting point for learning and upon which to base your future enhancements or applications.
In this particular case, you don't have to look past the very first constructor on the NSTimestamp reference page for the answer to your question.
Regards, Mark On Mar 9, 2006, at 9:32 AM, Jim Wong wrote: How do I return the system time to be passed into a NSTimeStamp?
_______________________________________________ Do not post admin requests to the list. They will be ignored. Help/Unsubscribe/Update your Subscription:
_______________________________________________ Do not post admin requests to the list. They will be ignored. Help/Unsubscribe/Update your Subscription:
|