• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

having the server system date in my JSP

 
Wall Schnok
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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.
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the 'mm' is giving you the minutes rather than the months. Try MM or MMM.
 
Wall Schnok
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok , frank , I'll become Wally Schnok , in fact I read about the "name policy" after my registration .
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic