How to display local time in lovelace

Can anyone tell me why this displays UTC instead of local time?

sensor:
  - platform: command_line
    name: get_time_date
    command: date "+ %I:%M %p";echo;date "+%b-%d-%Y"

My Lovelace display shows UTC while the same command on the rPi console shows the correct time.

Thanks for any advice.
Bart

Any specific reason you’re using command line to get date/time rather than built-in template/sensor?

Umm, No. Probably ignorance on my part. How would I get a sensor car to display:
Date

07:32 PM Aug-02-2021 (it’s actually 3:32 here Us Eastern TZ

See

1 Like

This works to eliminate the time-zone issue. I can’t seem to format the date to say Aug 03, 2021 instead of 2021-08-03 though.
Thanks for the tip - At least the time is correct now.

Cheers!

To alter the formatting, you’d have to use templates, but then the sensor is probably redundant.
See Templating - Home Assistant

1 Like