Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Birt changes date retrieved from database
Elja
<p>Hello.</p>
<p>
We just noticed that Birt changes in certain cases the date field value in the report.</p>
<p> </p>
<p>For example:</p>
<p>If the date in the field named "sulkemispaiva" is in format '2015-04-20 23:59:59.999' in the database, it is shown as April 21, 2015 12:00:00 AM in Birt.</p>
<p> </p>
<p>I was using a different time format (showing only the date). After changing format datetime to style showing also the time (12. October 2015 16.27.31 UTC+3), I noticed that whenever the time stamp of the field is 23:59:59.999 Birt (I guess) rounds it up to the next day 12:00:00 AM.</p>
<p> </p>
<p>How can I "tame" BIRT and keep the date as it is in the database? Only date is relevant in this case, not the time..</p>
<p> </p>
<p>Thanks in advance, Elja</p>
Find more posts tagged with
Comments
JFreeman
<p>What version of BIRT are you using?</p>
<p> </p>
<p>The first thought I have to get around this behavior is to change the date column into a string column. Then create a computed column to manually create the desired date value by dropping the time and just providing the desired date from the string into the new date object.</p>
Elja
<p>Hei Jesse.</p>
<p>I'm using Eclipse 4.5.0 (and to my acknowledge thing Birt goes along with that version-wise).</p>
<p>
I'll look into your suggestin, thanks!</p>
<p> </p>
<p>- Elja</p>
Elja
<p>Hi.</p>
<p> </p>
<p>Jesse's suggestion worked (although I didn't use computed column, but data-field).</p>
<p>It's a peculiar thing that BIRT rounded up the date in the first place...</p>
<p> </p>
<p>But: the solution for me worked as follows:</p>
<p>1) I changed the type of the existing "closing_date" from date to string.</p>
<p>2) I moved the "closing_date" field into a new column in the right side of the table</p>
<p>3) I created a new Date-typed data -field "cl_date" into the spot where I moved the "closing_date" from.</p>
<p>4) I copied the value from the old "closing_date" to the new "cl_date":</p>
<p>row["closing_date"]</p>
<p>5) I used the Properties - Format DateTime for cutting out the time -stamp and formatting (Custom - Finnish and format code: d.M.y) for pulling out just the date and in correct format.</p>
<p>6) After verifying that the date is now presented as it is in the database, I hid the old "closing_date" value (column -> visibility -> Hide element).</p>
<p> </p>
<p>And now I've tamed the date!</p>
<p> </p>
<p>- Elja</p>
JFreeman
<p>Thank you for providing the full details of your solution.</p>
<p>I'm glad that worked out for you.</p>
<p> </p>
<p>Let us know if you have additional questions.</p>