Convert java.util.Date to JCAPS DateTime Object

The only reference that I found for doing this is from here.

My own code to do the reverse:


com.stc.codegen.util.TypeConverter typeConverter = new com.stc.codegen.util.impl.TypeConverterImpl();
java.util.Date now = new java.util.Date();
String textFormatDate = "yyyyMMdd hh:mm";
java.text.SimpleDateFormat defaultDateTimeFormat = new java.text.SimpleDateFormat( textFormatDate );
String nowString = defaultDateTimeFormat.format( now );
com.stc.otd.xsd.datatype.DateTime dateTime = typeConverter.stringToDateTime( nowString, "yyyyMMdd HH:mm", false, "" );
myOtd.setEffectiveDate( dateTime );

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>