I want to display the users previous log in time. I created a query for it and this gives me the right field. But this always shows UTC time and not the user locale. I do need to show it in the users locale timezone. How do I show it in the users locale?
@AuraEnabled
public static LoginHistory getLoginHistory() {
List<LoginHistory> secondLogin = [ SELECT LoginTime
FROM LoginHistory
WHERE userId = :UserInfo.getUserId()
ORDER BY LoginTime DESC
LIMIT 1
OFFSET 1];
return ( secondLogin == null || secondLogin.isEmpty() )
? null
: secondLogin.get( 0 );
}