Manipulate Calender Times

Hi All,
I am using the Google Calendar component and currently have multiple calendars all showing the next event. What i would like to do is remove the seconds from all event times and if event all day hide the time. (Just showing date).
Here is what i have so far but cannot figure out how to change the time strings to what i want. (using sensor templates)

    friendly_name: "Next Holiday Event"
    value_template: >
        {{ states.calendar.holidays_in_united_kingdom.attributes.message }} :
          {% if (states.calendar.holidays_in_united_kingdom.attributes.all_day) == true %}
              All Day {{ states.calendar.holidays_in_united_kingdom.attributes.start_time }}
          {% else %}
              {{ states.calendar.holidays_in_united_kingdom.attributes.start_time }} - {{ states.calendar.holidays_in_united_kingdom.attributes.end_time }}
          {% endif %}
    friendly_name: "Next Contact Event"
    value_template: >
        {{ states.calendar.contacts.attributes.message }} :
          {% if (states.calendar.contacts.attributes.all_day) == true %}
              All Day {{ states.calendar.contacts.attributes.start_time }}
          {% else %}
              {{ states.calendar.contacts.attributes.start_time }} - {{ states.calendar.contacts.attributes.end_time }}
          {% endif %}

Any assistance or pointers would be much appreciated, thank you!

Your value template looks wrong in a lot of places. Just refering to your question about getting just the date:

{% set t = as_timestamp(states.calendar.contacts.attributes.start_time) | timestamp_local | string %}
{{ t.split(' ')[0] }}

Assuming that states.calendar.contacts.attributes.start_time is a datetime object.

Ok, so… i decided to rewrite your stuff and remove things that didn’t make sense to me.

    friendly_name: "Next Contact Event"
    value_template: >
        {% set msg = states.calendar.contacts.attributes.message %}
        {% set s_time = as_timestamp(states.calendar.contacts.attributes.start_time) | timestamp_local | string %}
        {% set e_time = as_timestamp(states.calendar.contacts.attributes.end_time) | timestamp_local | string %}
        {% if (states.calendar.contacts.attributes.all_day) == true %}
          {{ msg }} : All Day {{ s_time.split(' ')[0] }}
        {% else %}
          {{ msg }} : From {{ s_time.split(' ')[-1] }} to {{ e_time.split(' ')[-1] }} On {{ s_time.split(' ')[0] }}
        {% endif %}

That is great, yes your rewrite is much more readable also!
Hate to ask more but is there a way to reformat the date from

I ask because I think I will include these in a floorplan of my setup.

I do apologize, that should of been obvious. I achieved that with:
{% set s_date = as_timestamp(states.calendar.contacts.attributes.start_time) | timestamp_custom("%d %b") %}
Then added that to the end to get the result i like.

Still struggling with timezones as this week clocks change into daylight savings, appointments in BST currently show an hour ahead of what they should. I want always Google time rather than any conversion to my timezone.

Sorry, didn’t see your post til now. Yes, there are many ways to achieve what you want. WHat you posted is just one option. The other is to use strptime(entity_time).strftime(“format”).

Thank you for the pointers but i must still be using it wrong.
From documentation is see templates:
strptime(string, format) will parse a string to a datetime based on a format.
So i then do;
strptime(states.calendar.contacts.attributes.start_time, "%H:%M")

I cannot figure out how to use your suggestion. (This is just to get the %H:%M from calendar without converting to local timezone)

strptime is a pain in the ass, you need to know the format of start_time. I think its:

strptime(states.calendar.contacts.attributes.start_time, “%Y-%m-%d %H:%M:%S”).strftime("%H:%M")

That is perfect!
I was using the format i wanted within strptime not the format it is in.
Thank you for your help, really pleased with the results!

Glad it worked