英文:
Format Date and Time from an outlook email into excel sheet using power automate
问题
我正在尝试将日期和时间格式化为类似于 01/01/2023 08:00 上午的格式,在Power Automate中。我使用了表达式 formatDateTime(triggerOutputs()?['body/receivedDateTime'], 'MM/dd/yyyy hh:mm tt')
。我的问题是,我的Outlook显示我收到的电子邮件是在'2/7/2023 5:00 下午'(这也是我想在Excel中显示的格式),但在Excel中显示为'2/8/2023 0:00'。如何在Power Automate中将格式转换为我所需的格式?
英文:
I am trying to format the date and time to look like 01/01/2023 08:00 am in power automate. I used the expression formatDateTime(triggerOutputs()?['body/receivedDateTime', 'MM/dd/yyyy hh:mm tt)
. The issue I'm having is that my outlook shows that the email I received is on '2/7/2023 5:00 pm' (this is also the format I want shown in excel) but on excel it shows '2/8/2023 0:00'. How can I convert the format to my desired format in power automate?
答案1
得分: 0
在你分享的代码片段中,有几处拼写错误。一个右方括号缺失,日期时间格式的单引号字符也缺失。
你可以尝试使用以下表达式代替:
formatDateTime(triggerOutputs()?['body/receivedDateTime'], 'MM/dd/yyyy hh:mm tt')
此外,检查一下流程运行中的输入和输出,确保它被 Power Automate 正确格式化。
此外,请再次检查 Excel 列的格式设置。数值可能是正确的,但格式可能不同。
在单元格 B2 中,你可以看到数值显示为 "AM",但列 B 的格式可能不同。
英文:
In the code snippet you shared there are a couple of typos. A closing square bracket is missing and a closing single quote character for the date time format is missing.
Can you try the expression below instead?
formatDateTime(triggerOutputs()?['body/receivedDateTime'], 'MM/dd/yyyy hh:mm tt')
Also check your inputs and outputs in the flow run to make sure it is formatted correctly by Power Automate.
Also double check the column formatting setting within Excel column. The value might be correct, but the formatting could be different.
Below in Cell B2 you can see the value shows AM, but the format of B is different.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论