I have problem with a java project.
I have to convert a String
to com.mindfusion.common.DateTime
, all I managed to do is to convert it to org.joda.time.DateTime
using the following code:
org.joda.time.format.DateTimeFormatter formatter = DateTimeFormat.forPattern("dd/MM/yyyy HH:mm:ss");
org.joda.time.DateTime d2 = formatter.parseDateTime("2/7/2016 12:00:00");
I want to use it like that:
Appointment a = new Appointment();
a.setStartTime(d2);
but setStartTime()
needs com.mindfusion.common.DateTime
Any ideas?
It looks like you just want to call the constructor specifying all the various fields:
a.setStartTime(new com.mindfusion.common.DateTime(
d2.getYear(), d2.getMonthOfYear(), d2.getDayOfMonth(),
d2.getHourOfDay(), d2.getMinuteOfHour(), d2.getSecondOfMinute());
Note that it doesn't appear to have any time zone support, which is somewhat worrying...
See more on this question at Stackoverflow