sangameshrh
asked on
Changing date format while inserting to mysql from java
I have this code
Date date = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM- dd hh-mm-ss");
String dateOut = formatter.format(date);
stament.executeUpdateQuery ("INSERT INTO Date_Time_Table(dt_Time) VALUES(' " + dateOut + " ' ) ");
But it is stored as 2007-08-14
the time is not there
and also if I change the format to dd/mm/yyyy it is not accepting the format
Thanks
Date date = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-
String dateOut = formatter.format(date);
stament.executeUpdateQuery
But it is stored as 2007-08-14
the time is not there
and also if I change the format to dd/mm/yyyy it is not accepting the format
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Computer101
EE Admin