• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

date format

 
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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...

 
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
use this code
DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");

String today = formatter.format(date);

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

 
rakhi sinha
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.


--------------------------------------------------------------------------------
 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you please run the select query in db first and see if it is working fine.
 
reply
    Bookmark Topic Watch Topic
  • New Topic