Subscribe

RSS Feed (xml)

Powered By

Skin Design:
Free Blogger Skins

Powered by Blogger

Saturday, December 1, 2007

How to Format date in java

<%--
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.*" %>
<%@ page import="java.util.*" %>

<%! int count; %>
<%
String requestTime =
new SimpleDateFormat("hh:mm:ss a").format(new Date());

count = 0;
for (int i = 0; i < 10; i++) {
%>
Request at <%= requestTime %> count = <%= ++count %>

<%
Thread.sleep(250);
}
%>

No comments: