Birt Date Functions

rugajurugaju Junior Member
edited September 2010 in Designing Analytics Reports
I am trying to use a calculated date field in BIRT where I can pass a date and it can determine the third Tuesday of that month based on the date passed. Is there a Java script function i can use in BIRT for this kind of calculation?


  • mwilliamsmwilliams BIRT Guru
    edited December 1969
    Hi rugaju,

    If you pass a month and year to BIRT, you could figure out what day of week the first day of the month is, then calculate the date of the 3rd tuesday off of that value. Let me know if you have any questions on this.


    Michael Williams

    eSignLive Evangelism & Community Manager | eSignLive by VASCO
    Find me on:


    eSignLive Developer Community
    Email me:

  • thustonthuston Member
    edited September 2010
    This worked for me to get the 3rd Tuesday. There may be a simpler way, but I just computed it.

    var first = new Date(BirtDateTime.year(row["ORDERDATE"]),BirtDateTime.month(row["ORDERDATE"])-1,1);
    var tues = 2;
    var fstday = first.getDay();
    if ( fstday > tues )

    Get the first day of the month and find out what day it is.

    If greater than desired day (tues), then add up the remaining days of this week plus the days until next desired (tues) [7-fstday+tues].

    Else subtract the days before the first desired (Tues) [tues-fstday].

    Now you know the first desired/tuesday so add 14 to find the third.
Sign In or Register to comment.