Jump to content
We've recently updated our Privacy Statement, available here ×

How to converte String to Date


s.paskevics
Go to solution Solved by Java_Jasper,

Recommended Posts

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • Solution

I belive there are two ways to acomplish this witht he latter being best practices.

1) You could hard code it like so:

String date = 14121114235959

$P{FormattedDate} = new SimpleDateFormat("EEEE MMM dd, yyyy")

$P{FormattedDate}.format($P{date}) ;

2) Or you could use the JVM

But the better choice would be to use the JVM like so:

DateFormat.getDateInstance(DateFormat.MEDIUM, $P{REPORT_LOCALE}).format( $F{FormattedDate} )

DateFormat.getDateInstance(DateFormat.LONG, $P{REPORT_LOCALE}).format( $F{FormattedDate} ) 

This way it automatically reflects formatting choices already chosen by the user on his own PC.

 

Enjoy!

Link to comment
Share on other sites

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...