Format now : Date Calendar « JSP « Java






Format now

<%--
  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 %>


           
       








Related examples in the same category

1.Calendar Afternoon Jsp
2.Jsp Calendar Bean
3.Jsp Call Calendar Bean
4.Format date
5.Using the Date Class
6.Fields of the Calendar Class