Original Message:
Sent: 10-03-2023 06:46
From: Mohamed Smaili
Subject: dateTool in VTL
So I only insert the $dateTool.get('yyyy') in the footer and it must show up the year ?
------------------------------
Mohamed Smaili
Clever Circuits
Original Message:
Sent: 10-03-2023 06:29
From: Patrick Szabo
Subject: dateTool in VTL
You can simply use $dateTool.get('yyyy') for that. I tried it in a footer and it worked.
You don't need this line for that.
#set($dateTool = $tool.date)
------------------------------
Patrick
Original Message:
Sent: 10-03-2023 05:57
From: Mohamed Smaili
Subject: dateTool in VTL
I need to insert the the current year in the footer in excel using a velocity code. The code that I was trying to use is his
#set($dateTool = $tool.date)
#set($currentDate = $dateTool.date())
#set($year = $dateTool.getYear($currentDate))
But unfortunately this piece of code is not giving any output I tried to print out in excel every single variable in this code but it kept on printing a $ sign and variable name.
------------------------------
Mohamed Smaili
Clever Circuits
Original Message:
Sent: 10-03-2023 05:43
From: Patrick Szabo
Subject: dateTool in VTL
Can you provide a concrete example what you try to achieve? And maybe the code you tried?
------------------------------
Patrick
Original Message:
Sent: 10-03-2023 02:56
From: Mohamed Smaili
Subject: dateTool in VTL
Hello Patrick, the thing is that the year is not a field in an item I must automate it to read the year and update it accordingly if you got my point.
------------------------------
Mohamed Smaili
Clever Circuits
Original Message:
Sent: 10-03-2023 02:42
From: Patrick Szabo
Subject: dateTool in VTL
Hi Mohamed,
have you tried something like this?
#set( $org_date = "")#set( $year = "")## add your code here to get the $org_date. If it is e.g. a field in an item, you can use something like this:#set( $org_date = $velocityReportUtil.getValueForField($doc, "completion_date", $dateFormat))## then use dateTool to get the year:#set( $year = $dateTool.toDate('yyyy', $org_date))
I haven't tried it so I can't say for sure if this works.
------------------------------
Patrick
Original Message:
Sent: 10-02-2023 23:39
From: Mohamed Smaili
Subject: dateTool in VTL
Hello I am trying to automate the year in my velocity code, I saw that we can use the dateTool but unfortunately I tried to use it but whenever I print out the year it prints the variable name such as $year it seems dateTool is not supported, how can I solve this issue ?
------------------------------
Mohamed Smaili
Clever Circuits
------------------------------