Jump to content
JasperReports Library 7.0 is now available ×

How to show long from dbfiels as Date


ktrinad

Recommended Posts

By: Yuriy Stepanyuk - ystep

How to show long from dbfiels as Date

2003-03-19 09:07

How to write expression to show database field Long type as Date in TextField on report?

 

Thanks

Yuriy

 

 

 

 

 

By: Giulio Toffoli - gt78

RE: How to show long from dbfiels as Date

2003-03-19 16:46

Is the long a unix time?

 

Remember that the expression is a line of java code. You can write an expression like....

 

new java.util.Date( $F{MyField})

 

More complex....

 

java.text.FormatDate.getInstance().format( new java.util.Date( $F{MyField}.longValue() ) , "format_string")

 

If your long is in the form of

20030320000000

you can

 

 

 

 

By: Giulio Toffoli - gt78

RE: How to show long from dbfiels as Date

2003-03-19 16:48

... write something like...

 

(new String(""+$F{MyField})).substring(6,8) + "/" +

(new String(""+$F{MyField})).substring(4,6) +"/" +

(new String(""+$F{MyField})).substring(0,4)

 

 

Please note that all code provided is not tested, but coul be a good track....

 

I hope this helps you

Giulio

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...