Calculate Sunshine

Hi all,
I don’t get it. I want to calculate the sunshine and therefore I created an automation like this:

- alias: Sonnenschein Startuhrzeit setzen
  description: Startzeit zur Berechnung des täglichen Sonnenscheins
  mode: single
  trigger:
    - platform: state 
      entity_id: sensor.garten_bm_illumination
      to:
  condition:      
    - condition: numeric_state
      entity_id: sensor.garten_bm_illumination
      above: 100  
  action:
    - service: input_datetime.set_datetime
      target:
        entity_id: input_datetime.sunshine_start
      data:
         datetime: "{{ now().strftime('%Y-%m-%d %H:%M:%S') }}"

Thats ok so far.

Now I want to add another service which adds the minutes to an other input_number.

Should be sth like this:

{% set sunshine_duration_old =  states.input_number.sunshine_duration.state | int(0) %}
{% set sunshine_start =  states.input_datetime.sunshine_start.state   %}
{% set now =  now()  %}


How can I substract now - sunshine_start to get the minutes between those two datetimes ?

Thanks,
Olli