Change time format in admin console

Hi,

is is possible to change time format in Keycloak admin console, e.g. in section Events => Login Events => Time, the time format is => '10/25/19 8:19:06 AM, but I would like to change it to 24 hour format ?.

Kind Regards
Joakim

Yes. You just need to change the date filter format from “mediumTime” to something else. See line 84 here: https://github.com/keycloak/keycloak/blob/master/themes/src/main/resources/theme/base/admin/resources/partials/realm-events.html#L84

Format strings are here: https://docs.angularjs.org/api/ng/filter/date

ok, great I will try this.

Thanks

Hi,

I tired to change the line to

{{event.time|date:'yyyy-MM-dd'}} {{event.time|date:'HH:mm:ss Z'}} and restart keycloak but the date/time format is still the old. I tried to change in those 3 files, themes/base/admin/resources/partials/realm-events-admin.html themes/base/admin/resources/partials/realm-events.html themes/base/admin/resources/partials/user-detail.html

But no luck.
I don’t see what I’m missing ?

Kind Regards
Joakim

Try adding some extraneous text and see if that change shows up on the screen. In other words, make sure that changes you make are being picked up by Keycloak.

See docs to review how to extend themes and make changes.

Seems to be the same issue as in https://lists.jboss.org/pipermail/keycloak-user/2018-July/014815.html.
Setting my new theme in “Admin Console Theme” in master realm make it works.