I’m struggling with getting the year, month, day, hour, minute and second out of a variable.
I know I can use now().year, etc… but as I want to extract timestamps in different formats and I don’t want any difference between them caused by any delay. So I don’t want to use now() multiple times.
So I catched the timestamp in the variable ‘timestamp’. In python I then would extract the year using timestamp.year, but it won’t work in templating…
My question is, how can I extract year from my variable ‘timestamp’?
While it is working in the template editor, unfortunately I couldn’t get it to work in my script. It could be my mistake, because I don’t know what I’m doing exactly…
I tried two different ways:
Declaring a variable, but I can’t use strftime to declare a variable because the editor turns red and I can’t save.