jedistar
asked on
Gregorian Calender Year
Hi,
Everytime i get a my gregcalendar.year it comes up as '6'
How do i make it show the full year.. i.e 2006 or 1999
Everytime i get a my gregcalendar.year it comes up as '6'
How do i make it show the full year.. i.e 2006 or 1999
You need to use a DateFormat with yyyy
ASKER
example?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Let me rephrase my question.. i wish to compare a date in gregorian format
to a date in my db which is in varchar format.
how do i do this
(points up to 400)
to a date in my db which is in varchar format.
how do i do this
(points up to 400)
ASKER
using select sql
Please show how your varchar dates look
ASKER
30/1/6
30th jan 2006
30th jan 2006
DateFormat df = new SimpleDateFormat("MM/d/y") ;
java.util.Date fromDb = df.parse(resultSet.getStri ng("DateCo l"));
boolean dbLater = fromDb.after(otherDate);
java.util.Date fromDb = df.parse(resultSet.getStri
boolean dbLater = fromDb.after(otherDate);
following shows you how to parse a date
http://javaalmanac.com/egs/java.text/ParseDate.html?l=rel
you could also use a PreparedStatement and do the comparison directly in the query
that would save you havin g to bother with parsing altogether
http://javaalmanac.com/egs/java.text/ParseDate.html?l=rel
you could also use a PreparedStatement and do the comparison directly in the query
that would save you havin g to bother with parsing altogether
ASKER
How do i compare if a gregoraion date is equal to another greg date?
How do i convert a greg date to the above MM/D/Y
How do i convert a greg date to the above MM/D/Y
boolean equalDates = date1.equals(date2);
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
:-)