velocity - Comparing dates from PocketQuery -
velocity - Comparing dates from PocketQuery -
i'm trying create simple programme takes date , marks red, greenish or yellowish depending how far "today()" is.
i'm using pocketquery http://www.scandio.de/en/atlassian-en/plugins/pocketquery utilize log time oracle database, query loads fine , have nice little $result list.
this date
below used illustration template found in pocketquery doc utilize first step in getting script work. simple datetime compare. variable log_time in datetime format.
this script loops through result , x each row.
i've tested $dateformatter.getcurrentdatetime() , outputs right time. must reading of result think.
the next step compare more finegrained, check if log_time say...30 min set date , color yellowish first step compare working.
<style> .high { background: red; } .low { background: yellow; } </style> <table class="pocketquery-table confluencetable"> <tr> #foreach ($column in $columns) <th>$!column</th> #end </tr> #foreach ($row in $result) <tr class="#if($row.log_time < $dateformatter.getcurrentdate())high#{elseif} ($row.log_time > $dateformatter.getcurrentdatetime())low#end"> #foreach ($column in $row) <td>$!column</td> #end </tr> </table>
tldr:
how compare date got pocket query date velocity (dateformat, date, whatever)?
i update guys on progress. i've got code working closely want.
<style> .high { background: red; font-weight: bold;} .low { background: greenyellow; font-weight: bold; } </style> ##create instance of calender #set($todayateight = $calendar.getinstance()) ##set time, todo..check if there improve way of doing this... $todayateight.set(15, 10) $todayateight.set(12, 46) $todayateight.set(13, 5) $todayateight.gettime() <br/> <table> ##loop result #foreach ($row in $result) ##save parameter rowdate #set($rowdate = $calendar.getinstance()) $rowdate.settime($row.logg_tid) #if($todayateight.before($rowdate)) <tr class="low"> #else <tr class="high"> #end <td> $dateformatter.formatgivenstring("yyyy-mm-dd hh:mm:ss", $row.logg_tid) </td> <td> $row.dvh_area </td> </tr> #end </table>
velocity confluence
Comments
Post a Comment