Date and time with JCalendar and send it to a database with datetime field

2

How to store a date and time with JCalendar and send it to a database with datetime field?

    
asked by Facundo Lupacchino 27.10.2016 в 23:26
source

1 answer

0

Working with JDateChooser

int año = jdt.getCalendar().get(Calendar.YEAR);
int mes = jdt.getCalendar().get(Calendar.MARCH);
int dia = jdt.getCalendar().get(Calendar.DAY_OF_MONTH);

fecha =(año+"-"+mes+"-"+dia);

jdt is the name of the JDateChooser ...

When you save a date type the documentation says AÑO-MES-DIA that's why fecha is that way, then fecha you spend it by INSERT INTO likewise another variable where it corresponds.

    
answered by 28.10.2016 / 00:08
source