English 中文(简体)
java.sql。 改写日期
原标题:java.sql.Date to joda time conversion

或acle sql:

select trunc( sysdate,  Month ) month
from dual

java:

java.sql.Date sqlDate = resultSet.getDate("month");
log.info(sqlDate);
DateTime dateTime = new DateTime(sqlDate.getTime());
log.info(dateTime);
dateTime = dateTime.withMillisOfDay(0);
log.info(dateTime);

产出:

2012-01-01

2012-01T:00:00.000+07:00

2012-01T00:00:000+07:00

额外时间在哪里?

最佳回答

利用 LocalDate. FromDate Fields (date)将日期解释为当地(实时区)。 然后,如果有必要,请在<代码>地方<>上使用<>的方法(尽管如果您的物体确实是“调整日期”,那么<代码>地方<><>>/代码>是使用权。

问题回答

违约构造者使用系统违约构造者,这可能造成与《争端解决法》有关的问题。 我发现toDateMidhour在试图确保我实际上在午夜时发挥了真正有益的作用。

你们应当尝试这一法典。

LocalDate issueDate = new LocalDate(new Date());
System.out.println(new java.sql.Date(issueDate.toDate().getTime()))




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...