I have a date and I'm trying to print out correctly but without any success.
Here is the code I use
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm");
System.out.println(sdf.format(my_date));
where my_date is a Date object. the problem is that I always receive a date like this
Sat Jun 06 07:00:00 CEST 2015
Even if I have requested a date like this
dd/MM/yyyy HH:mm
Where is the mistake?
EDIT
I'm working on Java EE 7 environment with Glassfish installed. I have in my MySQL database a TIMESTAMP field like this 2014-06-18 07:00:00
. I get the value and print out through EL expression in a jsp page.
This is the entity where time fields are
public class Route implements Serializable
{
...
@Column(name = "DEPARTURE_DATE", nullable = false)
@Temporal(TemporalType.TIMESTAMP)
private Date departure_date;
@Column(name = "ARRIVAL_DATE", nullable = false)
@Temporal(TemporalType.TIMESTAMP)
private Date arrival_date;
...
I do a query and get the result list of routes and through EL expression I print all the field
<c:forEach items="${routes_list}" var="route">
<tr>
<td>${route.airlane}</td>
<td>${route.aircraft_id}</td>
<td>${route.airport_city_source.city}</td>
<td>${route.airport_city_dest.city}</td>
<td>${route.departure_date}</td>
<td>${route.arrival_date}</td>
<td>${route.travel_class}</td>
</tr>
</c:forEach>