File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Date object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Date object" Watch "Date object" New topic
Author

Date object

Eric Christensen
Greenhorn

Joined: Jul 29, 2002
Posts: 15
I have some code that I'm using to try and format dates between US and Canada. When I use the code in a stand alone:

everything works great. If I change the regional settings, everything is cool, I see the different formats and all. Now when I transform the code above into a servlet:

the date format never changes. I'm deploying this servlet in a test environment with Eclipse on my local machine, so shouldn't it be looking at my local settings? Is my code okay? Thanks in advance!


"No matter how hard you try, you cannot outthink a moron."
Avi Abrami
Ranch Hand

Joined: Oct 11, 2000
Posts: 1134

Hi Eric,
I think the key lies here
If I change the regional settings, everything is cool

but I couldn't find any details in your post about how you are changing your regional settings.
Also, the servlet engine may not allow you to change regional settings the same way that you can with a stand-alone java application. But again, I didn't see any details in your post about which servlet engine you are using.
Hope this has helped you.
Good Luck,
Avi.
Eric Christensen
Greenhorn

Joined: Jul 29, 2002
Posts: 15
I changed the regional settings in Windows. Control panel, region and language settings.
I'm using WSAD which runs WebSphere. I am testing with a 'test environment' which is something like running a little app server on the pc to see how the app would work deployed to a real server.
Vijesh Pavithran
Greenhorn

Joined: May 13, 2003
Posts: 2
Did you try restarting the server everytime you make a change in the regional settings?.
Eric Christensen
Greenhorn

Joined: Jul 29, 2002
Posts: 15
Yes. In fact I changed it to 'French' language and formatting and such. When I restarted the server, all of the server messages and such were in french, but the output was in the U.S. format.
Eric Christensen
Greenhorn

Joined: Jul 29, 2002
Posts: 15
Somehow now the servlet is working. Arrrggggh. I don't know why but it is. I definitely restarted earlier. Thanks for all your help though.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Date object