Meaningless Drivel is fun!*
The moose likes Beginning Java and the fly likes date format Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "date format" Watch "date format" New topic
Author

date format

rakhi sinha
Ranch Hand

Joined: Mar 26, 2012
Posts: 147
I have stored date in oracle database in dd/mm/yy format but when i retrieved date in pdf using this code ,it shows date in yyyy/mm/dd format ...but i want date in pdf in dd/mm/yyyy format.
Md. Minhajur Rahman
Ranch Hand

Joined: Apr 10, 2012
Posts: 33
If you have stored date in oracle database in dd/mm/yy format in field name suppose date in table1, when you want to retrieve the date in dd/mm/yyyy format, you can change the query as follows...

Eshwin Sukhdeve
Ranch Hand

Joined: Mar 15, 2012
Posts: 80
use this code
DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");

String today = formatter.format(date);

System.out.println("Today : " + today);

rakhi sinha
Ranch Hand

Joined: Mar 26, 2012
Posts: 147
Md. Minhajur Rahman wrote:If you have stored date in oracle database in dd/mm/yy format in field name suppose date in table1, when you want to retrieve the date in dd/mm/yyyy format, you can change the query as follows...


it is showing exception(document has no page) when i am doing this

show this exception

HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

ExceptionConverter: java.io.IOException: The document has no pages.


root cause

java.io.IOException: The document has no pages.
com.itextpdf.text.pdf.PdfPages.writePageTree(PdfPages.java:113)
com.itextpdf.text.pdf.PdfWriter.close(PdfWriter.java:1217)
com.itextpdf.text.pdf.PdfDocument.close(PdfDocument.java:787)
com.itextpdf.text.Document.close(Document.java:420)
LoginExample.generatepdf1.doPost(generatepdf1.java:155)
LoginExample.generatepdf1.doGet(generatepdf1.java:27)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


note The full stack trace of the root cause is available in the Apache Tomcat/6.0.32 logs.


--------------------------------------------------------------------------------
Manish Sridharan
Ranch Hand

Joined: Jul 19, 2005
Posts: 64
Can you please run the select query in db first and see if it is working fine.


Manish S.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: date format