convert XMLGregorianCalendar to date i.e “MM/DD/YYYY hh:mm:ss AM”

You can do this to return a Date:

calendar.toGregorianCalendar().getTime()

I found that code from this tutorial. From there, you can use a SimpleDateFormat to turn it into a string in the format you want.

But, if you’re using JDBC to save the date in the database, you probably can pass in the Date directly with this method:

preparedStatement.setDate(colNum, myDate);

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)