Convert UNIX Timestamp to Datetime


may be someone can give me a hint :slight_smile:
I try to convert a UNIX Timestamp into a usual datetime format, but all the my attempts fail :frowning:

Here is the sensor output as an integer: 1671693131000

I tried various attempts like the one described in Convert UNIX Time to normal Time or Timestamp convertion + time difference - #2 by Troon

1 Like

I found a solution, the provided Unix Timestamp is to long … so I cut off the last 3 figures :slight_smile:

Don’t forget to share the solution code to your question for the next guy running into the issue :v:

Sure here my code:

value_template: "{{as_datetime((state_attr('sensor.jaalee_sensor', 'list')[0].createTime | string)[:10])}}"

I cut of the last part of that UNIX Timestamp

1 Like