Convert a String to Date and a Date to String in Java (BeanShell)

Following example is dealing with string and date in Java tested in BeanShell command interpreter:bsh % import java.util.*;bsh % import java.text.*;bsh %bsh % DateFormat formatter;bsh % Date date;bsh % str_date = “Dec 2, 2010 18:38:00”;bsh %bsh % formatter = new SimpleDateFormat(“MMM d, yyyy HH:mm:SS”);bsh % date = (Date)formatter.parse(str_date);bsh % print(date);Thu Dec 02 18:38:00 ALMT 2010bsh […]