cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sbgoh
Helper V
Helper V

Format csv Table

Hi,

I created a csv table but when I export this file, the datetime contain look weird. Is there a way to format the date time to dd/mm/yyyy hh:mm:ss? I also wish to set remove the decimals for remaining days. Thanks!

 

sbgoh_0-1594810940399.png

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hello @sbgoh 

According to this post: https://powerusers.microsoft.com/t5/Building-Power-Apps/Get-current-user-s-timezone/td-p/280334

you could get the user's timezone using the following expression:

"UTC"
    & If(TimeZoneOffset() > 0, "-", "+")
    & RoundDown(Abs(TimeZoneOffset()) / 60, 0)
    & ":"
    & If(Mod(Abs(TimeZoneOffset()), 60) < 10, "0", "")
    & Mod(Abs(TimeZoneOffset()), 60)

Hope it helps!

Ferran

 

Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up

Did I answer your question? Please consider to mark my post as a solution to help others.
Proud to be a Flownaut!

View solution in original post

9 REPLIES 9
fchopo
Super User
Super User

Hello @sbgoh 

 

You should use the following expressions before exporting to CSV:

 

1) Remaining_Days:

div(float(int(first(split(string(mul(variables(‘Float value’),100)),’.’)))),100)

2) Issue_Date: 

formatDateTime('date_value','dd/MM/yyyy hh:mm:ss')

Hope it helps!

Ferran

Did I answer your question? Please consider to mark my post as a solution to help others.
Proud to be a Flownaut!

Hi fchopo

I am new to flow. May I know where should I put this expression? Inside "Create CSV table"?

I added this "formatDateTime('Issue Date','dd/MM/yyyy hh:mm:ss')"

 

I am getting this error:

 

The execution of template action 'Create_CSV_table' failed. The column values could not be evaluated: 'In function 'formatDateTime', the value provided for date time string 'Issue Date' was not valid. The datetime string must match ISO 8601 format.'.

 

Remove decimal point is not working too. Not sure did I do correctly?

 

 

 

 

v-bacao-msft
Community Support
Community Support

 

Hi @sbgoh ,

 

Follow @fchopo ‘s suggestions, you could refer to the expression to configure HTML table.

You first need to get the internal name of the field from the body of Get items, and then fill the field name in the expression.

207.PNG

split(string(item()?['Remaining_Days']),'.')[0]
formatDateTime(item()?['Issue_Date'],'dd/MM/yyyy HH:mm:ss')
item()?['internalName']

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi, I want to send a csv file to user through email. If I create HTML table, am I still able to send the CSV file ?

 

 

You can replace Create HTML action with Create CSV table action, there is no difference.

 

 

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Barry,

 

For the Issue date I manage to get it done but there is some time zone issue. Is there a way to convert to local time zone?

I am located Malaysia and I have Japan users. The Top Issue Date is the correct time.

 

sbgoh_0-1594882218087.png

 

Hello @sbgoh 

You should use the convertTimeZone function. More information about this function here: https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#c...

Whic use the following format:

convertTimeZone('<timestamp>', '<sourceTimeZone>', '<destinationTimeZone>', '<format>'?)

So, you should know your destination time zone for each record.

Hope it helps.

Ferran

Did I answer your question? Please consider to mark my post as a solution to help others.
Proud to be a Flownaut!

Hi @fchopo , I manage to solve it with your suggestion. Thanks!

Just one query, how to do dynamic destination time zone? E,g Australia, Japan and Malaysia. They are different zone. Is there a way to get the time zone in PowerApps?

Hello @sbgoh 

According to this post: https://powerusers.microsoft.com/t5/Building-Power-Apps/Get-current-user-s-timezone/td-p/280334

you could get the user's timezone using the following expression:

"UTC"
    & If(TimeZoneOffset() > 0, "-", "+")
    & RoundDown(Abs(TimeZoneOffset()) / 60, 0)
    & ":"
    & If(Mod(Abs(TimeZoneOffset()), 60) < 10, "0", "")
    & Mod(Abs(TimeZoneOffset()), 60)

Hope it helps!

Ferran

 

Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up

Did I answer your question? Please consider to mark my post as a solution to help others.
Proud to be a Flownaut!

View solution in original post

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Users online (1,601)