Forum Discussion
DolanH
7 years agoKhoros Staff
According to this documentation, you should be able to use the ?long builtin against the backing date to get the epoch date: https://freemarker.apache.org/docs/versions_2_3_17.html
- CarolineS7 years agoBoss
Thank you, DolanH!
Unfortunately, this isn't working for me, as the ?long only works on a number, and the date I'm working with appears to just be a string.
Here's the error, in case you're curious:
For "?long" left-hand operand: Expected a number, but this has evaluated to a string (wrapper: f.t.SimpleScalar): ==> user.registrationTime [in template "Hitbox" at line 6, column 53]
I'll keep working on this!
- VikasB7 years agoBoss
First, you need to convert it to date format then ?long will work. See here https://prnt.sc/j371fr
${datesupport.parseAsIso8601(user.registration_time)?long}
- CarolineS7 years agoBoss
Thank you very much, VikasB! I hadn't found the datesupport library in my searches - how very helpful!
Unfortunately, though, I can't get it to work.
${datesupport.parseAsIso8601(user.registrationTime)}
gives me
<div style="font-style: italic; font-weight: lighter; color: darkGrey; background-color: Beige; padding: 10px;" class="lia-widget-not-found"> This widget could not be displayed. </div>
Note that
${user.registrationTime}
DOES work to give me the user's registration time (sample result: Tue Mar 20 14:31:45 PDT 2018)
Do I need to do something special to enable datesupport?
Thanks!
Related Content
- 4 years ago
- 13 years agoInactive User
- 5 years ago