How do I get Current Time as this code is giving (Time–>Thu Jan 01 05:56:27 ACT 1970)??
DateFormat timeFormat = new SimpleDateFormat("HH:mm:ss.SS");
Date time = new Date();
String currentTime=timeFormat.format(time);
time=timeFormat.parse(currentTime);
System.out.println("Time-->"+time);
salesOrder.setOrderTime(time);
instead of
The problem is in formatting. You have not provided the Day,year fieldr, thats why it is acting that way. Or You can use this with proper formatting :
EDIT:
Try this:
Where
timeset inCalendar objectis time that is not parsed/formatted using simpleDateFormat.From
calendar object, you can get individual month , day , year and use it the way you like, or you can just callc.getTime()to get theDate object.