In formatDateTime, please tell me how to divide the time by the specified time.

NishimuraChinatsu-9854 756 Reputation points

@concat('delta/excel/year=',formatDateTime(convertFromUtc(addDays(utcNow(),-1),'Tokyo Standard Time'),'yyyy'),'/','month=',' formatDateTime(convertFromUtc(addDays(utcNow(),-1),'Tokyo Standard Time'),'MM'),'/','day=',formatDateTime(convertFromUtc(addDays( utcNow(),-1),'Tokyo Standard Time'),'dd'))




I want to store data in formatdatetime divided into hours at 0:00 and 14:00 of the day.

How do I write?

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
2,890 questions
{count} votes

1 answer

Sort by: Most helpful
  1. MayankBargali-MSFT 69,416 Reputation points

    @NishimuraChinatsu-9854 Thanks for reaching out. Can you share more details what you mean by I want to store data in formatdatetime divided into hours at 0:00 and 14:00 of the day. If you can share any example and what is the exception output then I can assist you.

    Assuming you want the string in the format delta/excel/year=yyyy/mm=MM/day=dd/hour=hh, where hh will be either 00 or 14, depending on the current hour in the Tokyo Standard Time time zone the you can use the below expression

    concat('delta/excel/year=',formatDateTime(convertFromUtc(addDays(utcNow(),-1),'Tokyo Standard Time'),'yyyy'),'/','month=',formatDateTime(convertFromUtc(addDays(utcNow(),-1),'Tokyo Standard Time'),'MM'),'/','day=',formatDateTime(convertFromUtc(addDays(utcNow(),-1),'Tokyo Standard Time'),'dd'),'/','hour=',if(equals(formatDateTime(convertFromUtc(utcNow(),'Tokyo Standard Time'),'HH'),'00'),'00','14'))

    In the above expression hour value will be either 00 or 14 depending if it is 00 hr then the value will be 00 else 14. You can further change the expression inside the if condition as per your need such as greater, greaterorequals, less or lessthanequal. For more details on the usage please refer to Logical comparison function.

    Feel free to get back to me if you need any assistance.