web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Conditional date&hour ...
Power Automate
Suggested Answer

Conditional date&hour formatting

(1) ShareShare
ReportReport
Posted on by 2
Hi all.

I'm trying to use a conditional date format and post it at a sharepoint list, getting data from a microsoft forms.

i'm using this approach:
if(
    empty(outputs('Obtener_los_detalles_de_la_respuesta')?['body/r37ce541b12614e19b5a2e4f8554b9d60']),
    '9999-12-31T00:00:00Z',
    formatDateTime(outputs('Obtener_los_detalles_de_la_respuesta')?['body/r37ce541b12614e19b5a2e4f8554b9d60'], 'yyyy-MM-ddTHH:mm:ssZ')
)
inside a Create Item box that goes to a SharePoint list. The date column at list is ok and working.

If i leave only: formatDateTime(outputs(
'Obtener_los_detalles_de_la_respuesta')?['body/r37ce541b12614e19b5a2e4f8554b9d60'], 
'yyyy-MM-ddTHH:mm:ssZ'
it works ok as long as i get a non blank date at the forms that captures the data.

Using a compose action before the create action and sending me the results the process works ok, giving me the correct results in each case.
The problem has to be at the Create Item box.

I will use some other date fields at Create Items box that will need the same type of expression to get other dates from the form.

Error:
Unable to process template language expressions in action 'Crear_elemento' inputs at line '0' and column '0': 'In function 'formatDateTime', the value provided for date time string '' was not valid.
The datetime string must match ISO 8601 format.'.


Thank you in advance.
Categories:
I have the same question (0)
  • Suggested answer
    Pstork1 Profile Picture
    69,657 Most Valuable Professional on at
    If you try to set the date and time in SharePoint manually you will find that it has a maximum value. If you set it beyond the max or min you get the following error.

    "You must specify a valid date within the range of 1/1/1900 and 12/31/8900."

    Try changing the first value to '8900-12-31T00:00:00Z'

  • Suggested answer
    CA1105 Profile Picture
    545 Moderator on at
     
    There is date range which SharePoint follows i.e.
     
    Min Date selection allowed: 1/1/1900 
    Max Date selection allowed: 12/31/8900
     
    Hope this helps.
  • Suggested answer
    Michael E. Gernaey Profile Picture
    53,968 Super User 2026 Season 2 on at
    Hi
     
    pretty please, give the issue you are having first, it doesn't help to read all the stuff, then do and this causes me this issue, as we weren't looking for issues
    we were just reading the code :-)
     
    I am sorry, I am not following what you are saying at all.
     
    You said the code you first listed works, so I dont understand why  you aren't using that then?
     
    So I am not even sure what the issue is, where it is, and what code you have that's causing it as you have so much just stuff. Please make it more clear by simplifying, without making suggestions.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 253 Super User 2026 Season 2

#2
11manish Profile Picture

11manish 172 Super User 2026 Season 2

#3
trice602 Profile Picture

trice602 134 Super User 2026 Season 2

Last 30 days Overall leaderboard