Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
imontoya14
Frequent Visitor

How to remove seconds from time column?

How can I remove seconds from this time column? any help is greatly appreciated. 

imontoya14_0-1617214368730.png

 

1 ACCEPTED SOLUTION
ERD
Super User
Super User

Hello @imontoya14 ,

Here is an option:

=DateTime.From(Number.RoundDown(Number.From(DateTime.From([Time]))*(24*60/1))/(24*60/1))

ERD_0-1617711082383.png

Also here is an article with explanation and other rounding options: How to categorize and group data in time intervals with Power Query .

 

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

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.

Check out my latest demo report in the data story gallery.

Stand with Ukraine!


Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

Thank you!

View solution in original post

6 REPLIES 6
ERD
Super User
Super User

Hello @imontoya14 ,

Here is an option:

=DateTime.From(Number.RoundDown(Number.From(DateTime.From([Time]))*(24*60/1))/(24*60/1))

ERD_0-1617711082383.png

Also here is an article with explanation and other rounding options: How to categorize and group data in time intervals with Power Query .

 

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

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.

Check out my latest demo report in the data story gallery.

Stand with Ukraine!


Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

Thank you!

selimovd
Super User
Super User

Hey @imontoya14 ,

 

add a new column with the DateTime.ToText function. With the second format parameter you can format it without seconds:

DateTime.ToText([DateTime], "yyyy/MM/dd hh:mm")

 

Afterwards change the date type again to "Date/Time". Then you should have the values without seconds.

If you want to skip one step you can also directly convert it to date/time in the same step:

DateTime.FromText( DateTime.ToText( [DateTime], "yyyy/MM/dd hh:mm" ) )

 

Let me know if that works for you. If you need any help please let me know.

If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

any help is appreciated. Thank you. 

Hi there, thank you for your response. That worked but it looks like it created another problem. Upon creating the new column and completing the changes above. It switched my AMs to PMs and vise versa. How can I fix this so the format (AM/PM) does not change. 

imontoya14_0-1617222754265.png

 

Your post helped me, to resolve the AM and PM issue, make sure you use capital HH like so

DateTime.From ( DateTime.ToText( [DateColumn] , "yyyy-MM-dd HH:mm") )

any help is appreciated. Thank you. 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.