如何将 org.joda.time.DateTime 转换为 com.mindfusion.common.DateTime
How to convert org.joda.time.DateTime to com.mindfusion.common.DateTime
我的 java 项目有问题。
我必须将 String
转换为 com.mindfusion.common.DateTime
,我所要做的就是使用以下代码将其转换为 org.joda.time.DateTime
:
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");
我想这样使用它:
Appointment a = new Appointment();
a.setStartTime(d2);
但是setStartTime()
需要com.mindfusion.common.DateTime
有什么想法吗?
看起来您只想调用指定所有不同字段的构造函数:
a.setStartTime(new com.mindfusion.common.DateTime(
d2.getYear(), d2.getMonthOfYear(), d2.getDayOfMonth(),
d2.getHourOfDay(), d2.getMinuteOfHour(), d2.getSecondOfMinute());
请注意,它似乎没有任何时区支持,这有点令人担忧...
我的 java 项目有问题。
我必须将 String
转换为 com.mindfusion.common.DateTime
,我所要做的就是使用以下代码将其转换为 org.joda.time.DateTime
:
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");
我想这样使用它:
Appointment a = new Appointment();
a.setStartTime(d2);
但是setStartTime()
需要com.mindfusion.common.DateTime
有什么想法吗?
看起来您只想调用指定所有不同字段的构造函数:
a.setStartTime(new com.mindfusion.common.DateTime(
d2.getYear(), d2.getMonthOfYear(), d2.getDayOfMonth(),
d2.getHourOfDay(), d2.getMinuteOfHour(), d2.getSecondOfMinute());
请注意,它似乎没有任何时区支持,这有点令人担忧...