Templating a Date string - what am I missing?

I need to craft a string that represent a date and time that along with a temp I need to send to my boiler to set a temporarily overridden temp setting.
Leaving the details aside I’m experimenting with the template editor in the dev tools

if I use this code to render the string (I’ll need to convert it to hex but that’s already solved)

{% set newtime=now()+timedelta(hours=states('input_number.temp_override_hours')|int) %}
{{  (states('input_number.temperature_override_temp') | float *10)|int }} {{  newtime.strftime('%H') }} {{  newtime.strftime('%M') }} {{  newtime.strftime('%S') }} {{  newtime.strftime('%d') }} {{  newtime.strftime('%m') }} {{  newtime.strftime('%Y') }}

the result is good (the input nr is now set to 1h offset):

215 23 51 00 11 02 2025

215 new temp setting (multiplied by 10 = 21.5°C)
23 51 00 time (+1h CET)
11 02 2025 date

but if I remove the spaces, placed here to help reading, the year goes back to 2024:

{% set newtime=now()+timedelta(hours=states('input_number.temp_override_hours')|int) %}
{{  (states('input_number.temperature_override_temp') | float *10)|int }}{{  newtime.strftime('%H') }}{{  newtime.strftime('%M') }}{{  newtime.strftime('%S') }}{{  newtime.strftime('%d') }}{{  newtime.strftime('%m') }}{{  newtime.strftime('%Y') }}

gives
21523581711022024

as this template render a number I though that there could be a rounding error of some kind but i I cast it to a string with something like this:

{% set newtime=now()+timedelta(hours=states('input_number.temp_override_hours')|int) %}
{{ ((states('input_number.temperature_override_temp') | float *10)|int|string + newtime.strftime('%H') +  newtime.strftime('%M') +  newtime.strftime('%S') +  newtime.strftime('%d') +  newtime.strftime('%m') +  newtime.strftime('%Y')) | string }}

result is also wrong.

21500030012022024

I know I’m missing something very stupid, can you point it to my dumb brain?

TY

well I kind of solved it, If I convert everything tho hex the result is good:

{% set newtime=now()+timedelta(hours=states('input_number.temp_override_hours')|int) %}
{{ ('%02x' % ((states('input_number.temperature_override_temp') | float *10)|int))| string + ('%02X' % newtime.strftime('%H')|int) + ('%02X' % newtime.strftime('%M')|int)+ ('%02X' % newtime.strftime('%S')|int)+ ('%02X' % newtime.strftime('%d')|int) + ('%02X' % newtime.strftime('%m')|int)+ ('%04X' % newtime.strftime('%Y')|int)}}

d70010000C0207E9
d7 = 215
00 = 00, midnight (now + 1h CET)
10 = 16
00 = 0 seconds
0C = 12 (tomorrow as is after midnight)
02 = 02/february
07E9 = 2025

strange…

Try this version.

{% set newtime = now() + timedelta(hours=states('input_number.temp_override_hours') | int(0)) %}
{{ (states('input_number.temperature_override_temp') | float(0) * 10) | int(0) }} {{ newtime.strftime('%H %M %S %d %m %Y') }}

Do you need the values in decimal or hexadecimal?

I’ll need the hex string as shown in the previous post as the boiler wants it that way. The hex string as I said is good.

With your tenplate the conversion is more difficult as i need to convert the pieces independently as the boiler needs every piece of the string temp,h,m,s,d,m,yyyy in hex values

There’s another way to do it but you’ve already found an acceptable solution so I won’t dwell on it.

{% set dt = now()+timedelta(hours=states('input_number.temp_override_hours')|int(0)) %}
{% set dt = dt.strftime('%H %M %S %d %m %Y').split()|map('int')|list %}
{% set t = (states('input_number.temperature_override_temp')|float(0)*10)|int(0) %}
{{'%02X%02X%02X%02X%02X%02X%04X' % tuple([t]+dt)}}