converting a number to a date.

birtnewbie
edited February 11, 2022 in Analytics #1
Hi,
I have a database table that has a numerical column. Now the problem is that the values it contains have actually been populated by a JAVA program that has put JAVA Date objects as long values inside this column.
I want to convert them back into a date that can be used for grouping in my report. Is there a BIRT function that can do this for me? can i do this using JavaScript?

Thanks in advance.

Comments

  • Virgil Dodson
    Virgil Dodson E admin
    edited December 31, 1969 #2
    Hi birtnewbie,

    That's an interesting username you chose for yourself since I suspect over time you will progress from birtnewbie to birtintermediate and finally to birtguru. :)

    In any case, I ran into a similar problem where the dates were being stored as EPOCH dates in our database. To get past this, I created a computed column on my data set. I called it 'realdate', set it as a Date format, and had the following expression.

    var d = new Date()
    var mEpoch = parseInt(row["origdate"]);
    if(mEpoch<10000000000) mEpoch *= 1000;
    d.setTime(mEpoch)
    d;

    I can then use this new computed field instead of the original field and perform proper grouping in tables and charts.
    Warning No formatter is installed for the format ipb
  • birtnewbie
    edited December 31, 1969 #3
    Vdodson,
    First of all, thank you for that warm welcome into the BIRT world, and birt-exchange. And thanks a ton for giving me that pointer. I suspected something like this would be used, but was not sure. Thank you for clarifying :)

    looking forward to sharing knowledge (and gaining it) on birt-exchange.