View Single Post
  #4  
Old October 14, 2005, 01:56 PM
Rubu's Avatar
Rubu Rubu is offline
Moderator
 
Join Date: February 15, 2004
Location: Michigan
Favorite Player: Mashrafee Mortaza
Posts: 8,361

SQL accept date format: yyyy-mm-dd

But java data format is, mm-dd-yyyy by default. I believe that is what causing the problem. you can change the date format for java, and fix the date format to yyyy-mm-dd and i think everything will be fine.

here is some code, that might help:

use these imports:
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

then, the code goes something like....
Date dst = new Date();
SimpleDateFormat yourDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
st = yourDate.format(dst);

Edited on, October 14, 2005, 6:56 PM GMT, by Rubu.
Reply With Quote