Re: webobjects-dev digest, Vol 1 #293 - 10 msgs
Re: webobjects-dev digest, Vol 1 #293 - 10 msgs
- Subject: Re: webobjects-dev digest, Vol 1 #293 - 10 msgs
- From: Robert Walker <email@hidden>
- Date: Fri, 13 Jun 2003 12:33:16 -0400
Denis,
Just as an FYI, I believe this has to do with the fact that WO has
moved from Objective C and bridged Java to pure Java. In previous
versions of WO there had to be a way to deal with date/time values
regardless of the language being used so all the date/time functions
were built into the WO APIs. Now that WO is pure Java, Apple has moved
all the date/time handling to the native Java API classes. This could
actually be a good thing, especially when integrating native Java
classes into WO applications. It should make for a more consistent
environment for Java developers.
As someone has already pointed out you need to get familiar with the
Java API for GregorianCalendar. There are actually examples shown in
the WO documentation for NSTimestamp about which native Java classes to
use for date/time calculations. Don't worry about all the deprecated
stuff in NSTimestamp. Java has everything you need.
Good Luck...If you need any further assistance let us know.
On Friday, June 13, 2003, at 01:01 AM,
email@hidden wrote:
Can anyone point me to the correct function for what I hope are simple
date calculations. I've spent a lot of time reading through the
methods but nearly everything says it's deprecated and refers me to
something else. The API seems to be a bit messy.
I'm using WebObjects 5.2 with Java 1.3.1 of course.
I'm writing a program to record car hires. I need to record start date
and return dates, compare these with other dates and also calculate the
duration of a hire.
I thought this would be a simple matter but I've struck two problems.
It seems that all date objects have been deprecated in favour of
NSTimestamp. That's OK except that the timestamps define a point down
to the millisecond level and I only want to work in days. If I use a
method like 'after', as in "if ( startdate.after(someDate)" the
comparison will figure out the milliseconds so two events on the same
date will not have the same timestamp.
So the question here is, how do I tell NSTimestamp to ignore the units
smaller than 1 day - or should I be using a different object?
The second problem is with intervals. I can't find a method to
calculate the number of days between two dates.
I apologize for asking such basic questions. I really expected this to
be simple but I just can't find my way through the deprecations and
"see alsos" in the documentation.
Denis Stanton
--
Sincerely,
Robert Walker
http://www.robertwalker1.com
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.