qinglau
11 years agoMentor
Control date format output
Hi All,
I would like to display the last login time of users in a date format :
dd-mm-yyyy, like 05-07-2013
I manage to use the REST API call get output : " Dec 12, 2013"
<#assign latestLogin = restadmin("/users/id/${user.id}/last_visit_time").value?date("yyyy-MM-dd") />
I could not find a way to control output like what I want. I have been look at two disccussion topics here:
http://community.lithium.com/t5/Developers-Discussion/How-to-format-date-time-output-nicely/m-p/43912#M1224 http://community.lithium.com/t5/Developers-Discussion/REST-API-Date-Format/m-p/51610#M1728
@xorrkaz , provides some tips in both post. However, i do not know what to do next. :(
Thank you, if you someone knows the answer of that.
Cheers,
Qing
qinglau That is because you are using a hard coded user ID '17' in the latestLogin and in lastVisit, you are using ${user.id} which is the current user.
use this:
<#assign latestLogin = restadmin("/users/id/${user.id}/last_visit_time").value?datetime("yyyy-MM-dd'T'hh:mm:ss")?string("dd-MM-yyyy") /> ${latestLogin}