File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

date conversion

 
Jolie Lee
Ranch Hand
Posts: 87
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi, got problem with date conversion.

for my input field, i have dd-mm-yyyy, when i stored into ms-sql, it becomes, mm-dd-yyyy, when i retrieved, it becomes yyyy-mm-dd. how can i convert into the format of dd-mm-yyyy?

i'm using the getter methods to get all the data in the db, therefore i can't really format it before i display it in my jsp pages.

i tried the jsf convertdatetime as well but it didn't seems to work.

any advise pls?
 
Arul Jose
Ranch Hand
Posts: 131
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
we are storing the time in milliseconds. so you can take it out and display it in any format.

jose
 
Jolie Lee
Ranch Hand
Posts: 87
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the data type i'm using for the date is datetime. i can't really change it because all the date are stored in this format.

when i create a getter method to convert the date into the format i want, it keeps giving me error:

javax.servlet.ServletException: An error occurred while evaluating custom action attribute "value" with value "${result.getPurchaseDateStr}": Unable to find a value for "getPurchaseDateStr" in object of class "$Proxy247" using operator "." (null)
 
Jolie Lee
Ranch Hand
Posts: 87
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i guess i can't create my own get method to do the conversion...

how can i localize my date format, for eg, whenever i select a date from db, i will automatically format it into dd-mm-yyyy?
 
Varun Khanna
Ranch Hand
Posts: 1400
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JSF provides date converter (Using DateFormat class) and it should work else you can use SimpleDateFormat class to do so while retriving your date from database.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic