0

Hello All,

I am new to JSP. Currently i am working on jsp project with mysql.
I got stucked with jsp date and time which supports mysql datetime format.

Please come up with your suggestions.
Thanks in Advance.

SHANTI.

3
Contributors
4
Replies
6
Views
6 Years
Discussion Span
Last Post by Shanti C
0

kindly be more specific with your problem.
One solution which i can give you is the use of java.util.DateFormat class

<%@ page import="java.text.*,java.util.*" session="true"%>
<html>
<head><title>Date Format Example</title></head>
<%!
DateFormat date = DateFormat.getDateInstance
(DateFormat.FULL, Locale.US);
String result = date.format(new Date());
%>
<b>Today's date is: <%= result %></b>
0

The DateFormat class also provides different styles like FULL, LONG, MEDIUM, SHORT.

FULL- it specifies completely, such as Wednesday, July 9, 2008 AD or 6:13pm.
LONG- it specifies as July 9, 2008 or 6:13pm.
MEDIUM - it specifies as Jul 9,2008.
SHORT - it specifies as 09.07.08 or 6:13pm

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.