bart56
August 2, 2021, 6:52pm
1
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
koying
(Chris B)
August 2, 2021, 7:11pm
2
Any specific reason you’re using command line to get date/time rather than built-in template/sensor?
bart56
August 2, 2021, 7:33pm
3
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
bart56
August 5, 2021, 8:32pm
5
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!
koying
(Chris B)
August 6, 2021, 7:12am
6
To alter the formatting, you’d have to use templates, but then the sensor is probably redundant.
See Templating - Home Assistant
1 Like