Re: System time
Re: System time
- Subject: Re: System time
- From: Chuck Hill <email@hidden>
- Date: Thu, 9 Mar 2006 08:23:17 -0800
On Mar 9, 2006, at 8: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?
Yes, you are assuming rather than researching. Were you to look in
the java.util.Calendar documentation, you would find this
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.
Extrapolating from Jan=0, March = 2
Chuck
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?
Warmest Regards,
Jim Wong
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40onpointsoftware.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40global-village.net
This email sent to email@hidden
--
Coming in 2006 - an introduction to web applications using WebObjects
and Xcode http://www.global-village.net/wointro
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems. http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden