This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Servlets and the fly likes having the server system date in my JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "having the server system date in my JSP" Watch "having the server system date in my JSP" New topic
Author

having the server system date in my JSP

Wall Schnok
Greenhorn

Joined: May 31, 2001
Posts: 8

I have a solution for this , in my JavaBean I have this function
public String readingSystemDate() {
Date data_sistema = new Date();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd/mm/yyyy");
String formatta_data_sistema = simpleDateFormat.format(data_sistema);
return formatta_data_sistema;
}
but the problem is that it gives me wrong months ( only the months , the days and the year values are OK ), to any refresh of the page !!! Incredible values like 45 , 44 or 56 !!!
There is another way to do the same thing ?
Thanks.
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
"wall",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please log in with a new name which meets the requirements.
Thanks.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
I think the 'mm' is giving you the minutes rather than the months. Try MM or MMM.
Wall Schnok
Greenhorn

Joined: May 31, 2001
Posts: 8
ok , frank , I'll become Wally Schnok , in fact I read about the "name policy" after my registration .
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: having the server system date in my JSP