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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Json array DateTime fo...
Power Automate
Unanswered

Json array DateTime format to mm/dd/yyyy

(0) ShareShare
ReportReport
Posted on by 55
 
31m ago

please help me to format json datetime (2023-07-03T09:03:10) to mm/dd/yyyy format and how to get each day first time in and last time out from json file

 

 

ssss.png

Categories:
I have the same question (0)
  • SamLed Profile Picture
    2,338 Moderator on at

    Hi,

     

    Sorry, I'm not sure to have correctly understood the "first time in and last time out" expression. Does it mean "Unique" or "Lowest and greatest for each date" ?

     

    If that means "Unique" you could do that this way, assuming you have a date string array:

     

    SamLed_2-1692269899798.png

     

    Results in:

     

    SamLed_1-1692269827296.png

    ______________________________________________________________

    If I have answered your question, please Accept the post as solution.
    If you like my response, please Thumbs Up.

     

     

  • SamLed Profile Picture
    2,338 Moderator on at

    If that means "lowest and greatest", then it's a bit more complex:

     

    Assuming we have this input array :

    SamLed_0-1692272266033.png

     

    We want this output array:

    SamLed_1-1692272312967.png

     

    Now here's the flow:

    • Start by initializing 3 variables, I use a compose to create my input datetime array, replace it by your input array:

    SamLed_2-1692272495749.png

     

    • Add a Select action to fetch date without time from array, add a compose to get unique dates and an Apply to each giving it the compose outputs:

    SamLed_3-1692273365834.png

     

    • Inside apply to each, add a filter array to fetch only datetimes matching current date, set both MinDate and MaxDate variables with first date from resulting array and add a new apply to each giving it the filter array outputs:

    SamLed_4-1692273812150.png

     

    • In this loop, we're checking if current date is lower than MinDate or Greater than MaxDate and store it in respective variable if true:

    SamLed_5-1692274173182.png

     

    • Now, inside first loop, just after second one, let's append MinDate and MaxDate formated to desired format to output array , I check if MinDate is not equal to MaxDate to avoid having twice time the same date if it was alone in input array:

    SamLed_6-1692274552350.png

     

    • Finally, below first loop, let's display resulting output array:

    SamLed_7-1692274701795.png

    ______________________________________________________________

    If I have answered your question, please Accept the post as solution.
    If you like my response, please Thumbs Up.

     

     

     

     

  • SamLed Profile Picture
    2,338 Moderator on at

    An optimized version of previous proposal:

     

    SamLed_0-1692287531421.png

    SamLed_2-1692287798570.png

     

    Where Append Min expression is : 

    replace(replace(replace(replace(replace(replace('yyyy-MM-ddTHH:mm:ss''yyyy', substring(outputs('Compose_-_Min_datetime'),0,4)), 'MM', substring(outputs('Compose_-_Min_datetime'),4,2)), 'dd', substring(outputs('Compose_-_Min_datetime'),6,2)), 'HH', substring(outputs('Compose_-_Min_datetime'),8,2)), 'mm', substring(outputs('Compose_-_Min_datetime'),10,2)), 'ss', substring(outputs('Compose_-_Min_datetime'),12,2))
     
    Append Max expression is: 
    replace(replace(replace(replace(replace(replace('yyyy-MM-ddTHH:mm:ss''yyyy', substring(outputs('Compose_-_Max_datetime'),0,4)), 'MM', substring(outputs('Compose_-_Max_datetime'),4,2)), 'dd', substring(outputs('Compose_-_Max_datetime'),6,2)), 'HH', substring(outputs('Compose_-_Max_datetime'),8,2)), 'mm', substring(outputs('Compose_-_Max_datetime'),10,2)), 'ss', substring(outputs('Compose_-_Max_datetime'),12,2))

     

     

    ______________________________________________________________

    If I have answered your question, please Accept the post as solution.
    If you like my response, please Thumbs Up.

     

     

  • cha143 Profile Picture
    55 on at

    hi thank you for answering here is the sample of dates that i converted in excel manually 

    capture2.PNG

     

    i need to capture the time in and time out of each date see the image for sample. please help me to create it in the powerautomate

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard