Datetime in java and default datetime mapping in hibernate -
I need some help about the state of confusion. Since I came from C # .NET, I was just like C # datetime for Java. While I manage to create a helpful method for converting date objects such as "2009-10-16 11:14:34" string representation of the date. Here is the method
public static date convertToDate time (string string date) {DateFormat df = New SimpleDateFormat ("yyyy-MM-dd HH: mm: ss"); Date; Try {date = df.parse (stringDate); } Hold (ParseException e) {e.printStackTrace (); } return date; }
Now I just want to continue now (I mean now date, like the actual date) like new date () and the same representation in the database in that date yyyy-MM -dd is HH: mm: s. Unless I am getting fundamental
Because I am using Hibernate, is it due to the mapping file? If so, then I have 2 questions 1 then how to map my property so that the new dates will be formulated in this format yyyy-MM-dd HH: mm: s2 How to do a default Datamate mapping so that the property is zero
You don 'you want your dates stored in any format, you Want them to be stored as a date?
This mapping definition can be default = now ()
part):
& Lt; / Property & gt;
Comments
Post a Comment