i had an issue converting between SQL server’s datetime to java’s java.util.date which has been resolved Parse Datetime to JAVA Date but now the issue is my datetime (01 Jan 2013) is converted to Tue Jan 01 00:00:00 PKT 2013 i want it to be like 01 Jan 2013 is it possible or i had to use the strings…
i tried the JODA time but the issue remains the same. please guide me through the correct path
EDIT:
i have datetime format in the SQL server db as dd MMM yyyy e.g 01 Jan 2013 i had to get the value from the SqlRowSet like rs.getString(4) now to convert the datetime string which i acquired from the DB to java.util.date that i did by using the guidelines in the question mentioned above, but the problem is it adds the additional info of zone and secods like
01 Jan 2013 SQL Server Format datetime
Tue Jan 01 00:00:00 PKT 2013 java.util.date format
what i want is the java.util.date to be like 01 Jan 2013
A
java.util.Dateis internally represented by a number (along), not by fields for day, month, hour, etc… You obtain those by formating this number with aSimpleDateFormat. The string you are getting now is a default representation obtained by usingDate.toString(). If you want it formatted differently, use theSimpleDateFormat.