/    Sign up×
Community /Pin to ProfileBookmark

dispaly date prob… help…

i have used prepared statement to insert date values in database..it is inserting..but the prob.. is that it cannot display date in dd-MON-yy format.i.e 26-jan-04

my query is like that:

java.util.Date dt1 = sdf.parse(request.getParameter(“chq_date”));//inserts in database

pstmt.setDate(1, new java.sql.Date(dt1.getTime()));

<td><input value=”<%= rs.getDate(“chq_date”) %>” name=”chq_date”></td>//displays date

to post a comment
Java

1 Comments(s)

Copy linkTweet thisAlerts:
@Khalid_AliDec 14.2004 — first of all using business code in JSP is huge no no,you must use some other way of doing things such as Struts or (JSF most recently)

Second once you get date from Resultset you will need to format it using

SImpleDateFormat object to your specific/desired format
×

Success!

Help @abhit_kumar spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...