I know that I need to set TimeZone somewhere, but I don’t know how I can “get” the current TimeZone from the user and display (dynamically?) The date with the correct offset.
This is my code:
Domain:
class MyClass {
Date myDate
}
Controller:
def unixSeconds = 1386760029
Date date = new Date(unixSeconds*1000L)
GSP:
<g:formatDate format="yyyy-MM-dd HH:mm" date="${MyClassInstance.myDate}" timeZone="${TimeZone.getTimeZone("GMT")}"/>
source
share