Telligent 10 - Velocity Template - get current datetime

1.7k views Asked by At

Using Telligent 10 platform and their native Velocity Template Language, how can we simply get the current datetime?

Per the many examples I've seen here on SO these first two require the $date var previously defined and those examples all define the date statically not by getting the current system datetime so the following do not work:

#set ($today = $date.getCurrentDate()) 
<span>$today</span>

#set ($today = $date.getDate()) 
<span>$today</span>

Per this Telligent Community thread I read that Telligent uses .NET DateTime (of which I'm very familiar) but ... these don't work either in Widget Studio:

#set ($today = DateTime.Now)
<span>$today</span>

#set ($today = new DateTime)
<span>$today.Now</span>
1

There are 1 answers

0
id.ot On BEST ANSWER

Found it. I overlooked the properties (literally the first section) outlined for the $core_v2_utility.

We can get the current date by using the following:

$core_v2_utility.CurrentDate