Get Current Date with Freemarker
How do I get the current date within Freemarker?
I am trying to determine if the user has logged in within the last week.
I have
<#assign my_lastlogin = user.lastVisitTime>
I thought something like
<#assign my_now = date.now>
might do the trick but I haven't found an easy way to get the current date in Freemarker. I was then going to just do a simple comparison. Can anyone help?
Thanks,
Jonathan
Hi Jonathan,
There's a custom context object for working with dates. You can find more about it here:
https://community.lithium.com/t5/Developer-Documentation/bd-p/dev-doc-portal?section=freemarker
You were actually pretty close with your guess!
If you're interested in learning more about developing within the Lithium platform, you should also check out the Lithium Developers forum:
http://lithosphere.lithium.com/t5/Lithium-Developers/bd-p/studio
Lots of good folks over there to help with Freemarker, Studio, and other development-related questions.
I hope this helps!