TIMESTAMP date format issue

Hi, Can someone help me on one issue. I have one email template where I am displaying user’s termination date. This value is coming from oracle DB where type of column TERM_SET_DATE is (TIMESTAMP). I am printing value in email template as {{$.getIdentity.attributes.terminationSetDate}} and this value is showing up as 2023-06-22 04:42:18.943921 Here I want to display value till 2023-06-22 04:42:18

In oracle database side this column value is 2023-06-22 04:42:18.943

Can you please suggest how can I do this.

Im not sure if you can use $dateTool class of velocity. Could you try the following sentence?

$dateTool.format('yyyy-M-d H:m:s', {$.getIdentity.attributes.terminationSetDate})

You can get more details about this class in the following link:

https://velocity.apache.org/tools/devel/apidocs/org/apache/velocity/tools/generic/DateTool.html

Hi Himanshu,
Can you convert it to string, then just grab the first 19 characters?

  1. Date handling
    Change the date format to your requirement using apache velocity script
    DateTool (VelocityTools 2.0 Documentation) (apache.org)

  2. You can split with dot here and take the 0 index using simple apache velocity script code in your email template.

Thanks
Krish

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.