0

I am trying to create a style that makes dates from the last week in bold. I have only been able to get it to work by putting in an explicit date like below. I would like to have a dynamic "last week" based on the current date.

<style name="Date_Bold" isBold="false">    
    <conditionalStyle>
       <conditionExpression><![CDATA[$F{$F{account_date}.toString() > '2011-10-17 00:00:00']]></conditionExpression>
       <style isBold="true"/>
    </conditionalStyle>
</style>
mdahlman
  • 9,204
  • 4
  • 44
  • 72
FSUmatt
  • 3
  • 2

1 Answers1

0

  • You can try this expression to get 'last week' (today minus seven days)
    <![CDATA[new Date(System.currentTimeMillis() - (7 * 1000 * 60 * 60 * 24))]]>
    

    You can see also this link for better understanding this solution.

  • You can try to get date via SQL query and put the result value to the new Date field.
    It would be something like this for Oracle:
     SELECT account_date, sysdate-7 as last_week, ... FROM table ...
    

    It would be something like this for MS SQL:

    SELECT account_date, (GETDATE() - 1) as last_week , ... FROM table ...
    

  • Another way to pass date from code via parameter.

  • Or you can try to import Joda library for example. Here is the sample of scriplet using.
  • Community
    • 1
    • 1
    Alex K
    • 22,315
    • 19
    • 108
    • 236