A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Java in General
Displaying the Date - Issue
Joined: Dec 20, 2008
Sep 02, 2009 00:15:02
Can you please anyone give me solution for this below issue.
I am trying to print the System current date.
code it is printing correct date, while displaying on the browser TextFiled it is showing the previous date.
For this i used the code like
Date_Format = "MM-dd-yyyy";
Calendar cal = Calendar.getInstance();
sdf = new
Jesper de Jong
Joined: Aug 16, 2005
Sep 02, 2009 01:12:26
Viswas majrekar wrote:
Why are you formatting and then immediately parsing the date again? If you need a Date object, just do:
Date date = cal.getTime();
If you need to convert a Date object to a String, format it:
String text = sdf.format(date);
parse() does the opposite of format() - it converts a String to a Date object. First formatting and then immediately parsing a Date object effectively does nothing.
I agree. Here's the link:
subject: Displaying the Date - Issue
Problem in Changing Timezone (URGENT)
JSP and Access - Date function problems
How to get Date Format of a System??
Problem with date insertion in MySQL
converting dateformat compatible to oracle date
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013