0
我有一個java項目的問題。如何將org.joda.time.DateTime轉換爲com.mindfusion.common.DateTime
我不得不轉換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
任何想法?
你是對的,我也要添加時區(我想要格林威治標準時間) – taleporos
我在每一個'.get()'exept'.getYear()' – taleporos
@taleporos:編輯getters ...但我不'我知道你的意思是「我還要添加時區」 - 關鍵是'mindfusion'版本沒有*時區,就我所見。 (對於一個「複雜的」日期/時間API,它對我來說看起來相當糟糕......) –