cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
TonyHansson
Regular Visitor

Change date and time

Hi

 

I have a column with a date and time.

 

I need to keep the date, but change the time to always be 15:00

 

I have tried different but no luck.

 

Custom column = Date.From([#"Column"]) + #duration(0,15,0,0)

 

Regards

 

Tony

 

1 ACCEPTED SOLUTION
HotChilli
Super User
Super User

You could try constructing a datetime and hardcoding the time .

Here's a start:

#datetime(Date.Year([Column1]), Date.Month([Column1].....

View solution in original post

3 REPLIES 3
AlexisOlson
Super User
Super User

You could also use DateTime.ToText and DateTime.FromText like this:

DateTime.FromText(DateTime.ToText([Column], [Format="yyyy-MM-dd 15:00:00"]))

 

TonyHansson
Regular Visitor

Hi @HotChilli 

 

Worked perfect Thank you

 

#datetime(Date.Year([#"M&P deadline"]),Date.Month([#"M&P deadline"]),Date.Day([#"M&P deadline"]),15,00,00)

HotChilli
Super User
Super User

You could try constructing a datetime and hardcoding the time .

Here's a start:

#datetime(Date.Year([Column1]), Date.Month([Column1].....

Helpful resources

Announcements
Vote for T-Shirt Design

Power BI T-Shirt Design Challenge 2023

Vote for your favorite t-shirt design now through March 28.

March 2023 Update3

Power BI March 2023 Update

Find out more about the March 2023 update.

March Events 2023A

March 2023 Events

Find out more about the online and in person events happening in March!

Top Solution Authors
Top Kudoed Authors