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

How i can to convert a String to Date?


ktrinad

Recommended Posts

By: Marcelo - mike81

How i can to convert a String to Date?

2003-11-10 08:12

Hi.

 

How i can to convert a string to date with format "yyyy-mm-dd" without using the Format Pattern?

 

Thank's.

 

 

 

 

By: Giulio Toffoli - gt78

RE: How i can to convert a String to Date?

2003-11-10 15:08

if your string is of type...

 

YYYY-MM-DD you can use an expression like this:

 

 

(($P{MyDate} != null && $P{MyDate}.length() == 10) ? $P{MyDate}.substring(8,10)+"/"+$P{MyDate}.substring(6,8)+"/"+$P{MyDate}.substring(0,4) : "")

 

 

The result is: DD/MM/YYYY

 

Enjoy

 

Giulio

Link to comment
Share on other sites

  • 2 years later...
  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

  • 12 years later...

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