Date format : Data Type « JSP « Java Tutorial

  Copyright (c) 2002 by Phil Hanna
  All rights reserved.
  You may study, use, modify, and distribute this
  software for any purpose provided that this
  copyright notice appears in all copies.
  This software is provided without warranty
  either expressed or implied.
<%@ page import="java.text.*,java.util.*" session="false"%>
   DateFormat fmt = new SimpleDateFormat("hh:mm:ss aa");
   String now = fmt.format(new Date());
The time is <%= now %>

23.3.Data Type
23.3.1.An Automatic Data Conversion
23.3.2.Casting to a New Type
23.3.3.Format Date
23.3.4.Date format