Converting Month and Year in Power Automate

516
4
Jump to solution
06-08-2023 10:10 AM
FavaN2021
New Contributor III

Hello, 

I am creating a workflow that is triggered when a survey is submitted. In the survey I have month and year as a question, I would like the feature attribute to be apart of the email, but it is displaying as a long string of numbers. 

 

I have created the following expression and still now luck; 

 

formatDateTime(triggerOutputs()?[body/feature/attributes/'Month_Year'],'MMM'). 

 

 

0 Kudos
1 Solution

Accepted Solutions
beachcamp
New Contributor III

Survey123 captures dates in "Epoch" or "Unix" time, which is to say seconds or milliseconds since Jan 1 1970. 

This causes all sorts of fun for conversions in other systems, in fact sometimes I'm not sure if the Survey123 feature classes knows quite how to handle it. Although that's partly timezone issues I'm sure, but I digress.

 

In my power automate fields I create an expression like: 

addSeconds('1970-1-1', Div(triggerOutputs()?['body/feature/attributes/survey_date'], 1000), 'yyyy-MM-dd')

This takes any given date (in epoch time) coming from survey123 and returns a string like '2023-06-08', format as you please!

View solution in original post

4 Replies
beachcamp
New Contributor III

Survey123 captures dates in "Epoch" or "Unix" time, which is to say seconds or milliseconds since Jan 1 1970. 

This causes all sorts of fun for conversions in other systems, in fact sometimes I'm not sure if the Survey123 feature classes knows quite how to handle it. Although that's partly timezone issues I'm sure, but I digress.

 

In my power automate fields I create an expression like: 

addSeconds('1970-1-1', Div(triggerOutputs()?['body/feature/attributes/survey_date'], 1000), 'yyyy-MM-dd')

This takes any given date (in epoch time) coming from survey123 and returns a string like '2023-06-08', format as you please!

FavaN2021
New Contributor III

Thank you !  This worked for me!

KDHEITGIS
New Contributor

I have the same issue, for some reason it is not working for me! Could you send me screenshots of your steps. 

0 Kudos
TheGeneralissimo
New Contributor

@beachcamp , I'm using this expression, but the date I'm getting (August 28, 5217) is not what is should be (February 16, 2024). Any thoughts?

TheGeneralissimo_0-1708112818661.png

 

0 Kudos