Merge pull request #563 from mohitsinha/develop
JdbcSupport added utility function for getting localDateTime after considering timezone of tenant
This commit is contained in:
+11
@@ -29,6 +29,8 @@ import org.joda.time.LocalDate;
|
||||
import org.joda.time.LocalTime;
|
||||
import org.springframework.jdbc.support.JdbcUtils;
|
||||
|
||||
import static org.apache.fineract.infrastructure.core.service.DateUtils.getDateTimeZoneOfTenant;
|
||||
|
||||
/**
|
||||
* Support for retrieving possibly null values from jdbc recordset delegating to
|
||||
* springs {@link JdbcUtils} where possible.
|
||||
@@ -44,6 +46,15 @@ public class JdbcSupport {
|
||||
return dateTime;
|
||||
}
|
||||
|
||||
public static DateTime getLocalDateTime(final ResultSet rs, final String columnName) throws SQLException {
|
||||
DateTime dateTime = null;
|
||||
final Timestamp dateValue = rs.getTimestamp(columnName);
|
||||
if (dateValue != null) {
|
||||
dateTime = new DateTime(dateValue.getTime()).withZone(getDateTimeZoneOfTenant());
|
||||
}
|
||||
return dateTime;
|
||||
}
|
||||
|
||||
public static LocalDate getLocalDate(final ResultSet rs, final String columnName) throws SQLException {
|
||||
LocalDate localDate = null;
|
||||
final Date dateValue = rs.getDate(columnName);
|
||||
|
||||
Reference in New Issue
Block a user