On Fri, 6 Apr 2001, Martin Mauri wrote:
> Hey...don't be so rude, let the boys work their problems out...
There is something to be said for keeping a list on-topic, and people
asking questions on appropriate forums.
> > Are we in the tomcat-user forum ???
> > I don't see the relationship between a so simple constructor problem
> > (which Javadoc solve quiet easily ...) and Tomcat ...
> >
> >
> > Alistair Hopkins a �crit :
> > >
> > > try "select myDate - 7 from myTable;" in your SQL statement for a quick
> fix
> > > :-)
> > > (works on postgres, don't know about msql)
> > >
> > > -----Original Message-----
> > > From: Michael Wentzel [mailto:[EMAIL PROTECTED]]
> > > Sent: Friday, April 06, 2001 12:58 PM
> > > To: '[EMAIL PROTECTED]'
> > > Subject: RE: Dates in Java
> > >
> > > I have a simple question about the Date object (or similar object)
> > >
> > > I have a mySQL table with a DATETIME cell. I want to get the date from
> this
> > > cell
> > >
> > > (formatted like so: e.g. 2001-03-23 13:04:59)
> > >
> > > and retrieve the date that is exactly 7 days earlier than the retrieved
> > > date.
> > >
> > > What is the easiest way to do this? I noticed a lot of method
> deprecations
> > > in the specs and I am having trouble using the Date object.
> > > -----
> > > For example,
> > > DateTest.java:20: cannot resolve symbol
> > > symbol : constructor Date ()
> > > location: class java.sql.Date
> > > Date d = new Date();
> > > ^
> > > 1 error
> > >
> > > -----
> > >
> >
> > --------------------------------------------------------------------------
> --
> > > ---------
> > > First, in regards to displaying your date use the java.text.DateFormat
> > > class(note DateFormat
> > > is abstract so of course you'll want to use one of the 'implementation'
> > > classes). Since
> > > java.sql.Date extends java.util.Date you can of course use the
> > > java.text.DateFormat classes
> > > to format a java.sql.Date.
> > >
> > > Secondly, the problem you are having using java.sql.Date could be if you
> are
> > > importing java.util.*. This will import java.util.Date in addition to
> > > java.sql.Date.
> > > Therefore, when you code Date d = new Date() the compiler doesn't know
> which
> > > classdef
> > > to use. One solution to to not import anything using splay(*). This is
> the
> > > way we
> > > do it. You import block may get a little large but it also makes it
> easier
> > > for other
> > > developers to figure out where to look for source. Another is to code
> it as
> > > java.sql.Date d = new java.sql.Date();
> > >
> > > ---
> > > Michael Wentzel
> > > Software Developer
> > > Software As We Think - http://www.aswethink.com
> >
> > --
> > Cordialement,
> >
> >
> > St�phane BAUDET
> >
> > _________________________________________________________
> > GL Trade
> > 48, rue Notre Dame des Victoires - 75002 Paris
> > Tel : 01 53 40 43 12 (interne 1312)
> > Fax : 01 53 40 01 40
> > Email : [EMAIL PROTECTED]
> > _________________________________________________________
>
Milt Epstein
Research Programmer
Software/Systems Development Group
Computing and Communications Services Office (CCSO)
University of Illinois at Urbana-Champaign (UIUC)
[EMAIL PROTECTED]