[
https://issues.apache.org/jira/browse/OLINGO-247?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13970470#comment-13970470
]
Chandan V.A commented on OLINGO-247:
------------------------------------
Example Code
public Date getCreationDate() {
if (creationDate == null) {
return null;
}
long dbTime = creationDate.getTime().getTime();
Date originalDate = new Date(dbTime +
TimeZone.getDefault().getOffset(dbTime));
return originalDate;
}
public void setCreationDate(final Calendar creationDate) {
long originalTime;
if (creationDate != null) {
originalTime = creationDate.getTime().getTime();
} else {
originalTime =
Calendar.getInstance(TimeZone.getDefault()).getTime().getTime();
}
Date newDate = new Date(originalTime -
TimeZone.getDefault().getOffset(originalTime));
Calendar newCalendar = Calendar.getInstance();
newCalendar.setTime(newDate);
this.creationDate = newCalendar;
}
> Date Time and Time Zone Issue
> -----------------------------
>
> Key: OLINGO-247
> URL: https://issues.apache.org/jira/browse/OLINGO-247
> Project: Olingo
> Issue Type: Question
> Components: odata4-server
> Affects Versions: V2 1.2.0
> Reporter: Selvaratnam Ruckman Colins
> Priority: Blocker
>
> I am using MySql data base to store Odata information,One of my table has
> date column with value as "2013-04-02" and In my JPA entity I map this column
> to Java Calender as follow
> @Column(name = "date",columnDefinition="DATE")
> @Temporal(TemporalType.DATE)
> private Calendar tradingDate
> But when i fetch these entities using Odata the date comes as
> <d:TradingDate>2013-04-01T18:30:00</d:TradingDate>
> In fact All dates in the table come with some reduction value which may be
> Time Zone offset & My local time zone is IST(+5.30)
> I think the date is been converted to GMT or UTC by olingo, How do i resolve
> this issue?
--
This message was sent by Atlassian JIRA
(v6.2#6252)