ustawianie czasu w javie

0

Witam mam problem z poprawnym opisaniem daty, a następnie użycia jej do przeszukania bd.
oto kod...
<%@ page contentType="text/html; charset=iso-8859-2" %>
<%@ include file="/include/imports.jsp" %>
<%@ include file="/include/constants.jsp" %>
<%@ include file="/include/stylesheet.jsp" %>
<%
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
int month = calendar.get(Calendar.MONTH) - 1;
if (month < 0)
{
month = 11;
year = year - 1;
}
String periodFrom = request.getParameter("periodFrom");
if (periodFrom == null || periodFrom.equals(""))
{
periodFrom = "" + year + "-" + (month + 1) + "-1";
}
String periodTo = request.getParameter("periodTo");
if (periodTo == null || periodTo.equals(""))
{
GregorianCalendar gregorian = new GregorianCalendar(year, month, 1);
int numberOfDays = 31;
switch (month)
{
case Calendar.FEBRUARY :
if (gregorian.isLeapYear(year))
{
numberOfDays = 29;
}
else
{
numberOfDays = 28;
}
break;
case Calendar.APRIL :
case Calendar.JUNE :
case Calendar.SEPTEMBER :
case Calendar.NOVEMBER :
numberOfDays = 30;
break;
}
periodTo = "" + year + "-" + (month + 1) + "-" + numberOfDays;
}
String date = request.getParameter("date");
if (date == null || date.equals(""))
{
date = Settings.getValue(application, "faktura.ogolne.termin", "");
}
%>

<%
String location = "<a class=locationLink href=" + applicationPath + "menu/index.jsp>moduły</a> / faktury / generowanie";
%>

<%@ include file="/include/header0.jsp" %>

<%@ include file="/invoices/menu.jsp" %>
<%@ include file="/include/header1.jsp" %>

Generuj faktury
okres od <input class="normalEdit" name="periodFrom" value="&lt;%= periodFrom %">">
okres do <input class="normalEdit" name="periodTo" value="&lt;%= periodTo %">">
termin płatności <input class="normalEdit" name="date" value="&lt;%= date %">">
<input class="normalButton" name="generateButton" type="button" value="generuj" onclick="submit0(frm, 'Czy wygenerować faktury ?')"> <input class="normalButton" name="cancelButton" type="button" value="cofnij" onclick="history.go(-1);">
<%@ include file="/include/footer.jsp" %> prosze o pomoc :)
0

Hm... do przeszukania db znacznie lepiej nadaje się obiekt Date i wybieranie liczby milisekund.
Zresztą nie widzę w kodzie tego jak przekazujesz to do szukajki. Możliwe że tam jest problem

1 użytkowników online, w tym zalogowanych: 0, gości: 1