ktrinad Posted August 31, 2006 Share Posted August 31, 2006 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 More sharing options...
dprogrammer Posted November 7, 2008 Share Posted November 7, 2008 Giulio , this is exactly what I was also looking for. Thanks for this post. Link to comment Share on other sites More sharing options...
atrace Posted November 8, 2008 Share Posted November 8, 2008 I've used the SimpleDateFormat class, might be a little easier if you have mulitple date formatsexample:(new SimpleDateFormat("yyyyMMdd HHmmss")).parse($F{Date}) http://java.sun.com/j2se/1.5.0/docs/api/java/text/SimpleDateFormat.htmlPost Edited by Austyn Trace at 11/08/08 17:18 Link to comment Share on other sites More sharing options...
rildo.omar Posted April 14, 2021 Share Posted April 14, 2021 Fix:(($P{MyDate} != null && $P{MyDate}.length() == 10) ? $P{MyDate}.substring(8,10)+"/"+$P{MyDate}.substring(5,7)+"/"+$P{MyDate}.substring(0,4) : "") Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now