I want to display time in user’s time zone.
But for some reason the server always shows UTC time:
The code I used to display this:
<div class="DateTime">
<div>Date &<br>Time:</div>
<div id="VoltageReadingDateValue">$doc.date</div>
</div>
I’ve set default timezone to be Singapore in Wiki settings, and In my user settings I just have the default timezone:
Yet the time is displayed for UTC time zone. The edited document in wiki itself is also displayed in UTC time and not in local user time.
I also tried this:
{{velocity}}
#set ($userDoc = $xwiki.getDocument($xcontext.user))
#set ($userObj = $userDoc.getObject('XWiki.XWikiUsers'))
$datetool.format('default', 'default', $doc.date, 'en', $userObj.get('timezone'))
{{/velocity}}
But instead of a date string, I just get the $datetool.format('default', 'default', $doc.date, 'en', $userObj.get('timezone'))
string.
What do I do to fix it?