I try to insert some dates in MySQL from the Java code but i fail to insert it in proper format. The default format of MySQL is "yyyy-MM-dd". So i set this as my default too. But when i insert the date it changes like this.. "0029-22-08"..Where '08 is the year field... Why this happens.. How could i change that to its proper default format... And here is my code
: Edited :
Never try to be a hard-worker. Be a smart-worker.
Originally posted by Rajkumar balakrishnan: How that'd be false... I just parse the date and store it in d1 and then format it to the required format and transfer it to date variable. Is this wrong? Just for clarification only i ask this!!
You parsed the date string and then formatted it to the format it was originally stored in. Now if you had formatted it to the required format -- which you didn't -- that would have worked. It would have been clumsy but it would have worked.
i got a clear definition with my problem regarding storing date in mysql... and i now retrieve the date using Preparedstatement's getDate() method but it shows date by a default format like 'yyyy/MM/dd'.. But i want it to display in 'dd/MM/yyyy' format... How could i achieve it..Please guide me....