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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

convert string to datetime

Hi, I have a table like this :

mhv22_0-1665360978014.png

I need to convert the string to a datetime . The row 52 should be 06/09/2020 01:00:00, row 53 = 06/09/2020 02:00:00. So I can plot a series time by hour based on days. Is it possible?

Thanks in advance!

2 ACCEPTED SOLUTIONS
ryan_mayu
Super User
Super User

@Anonymous 

you can try this

Column = 
VAR _date=date(left('Table'[hourofday],4),mid('Table'[hourofday],5,2),mid('Table'[hourofday],7,2))
VAR _time=time(right('Table'[hourofday],2),0,0)
return _date+_time

1.PNG





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

Proud to be a Super User!




View solution in original post

you are welcome





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

Proud to be a Super User!




View solution in original post

3 REPLIES 3
Anonymous
Not applicable

@ryan_mayu  . Thanks a lot! It worked perfect!

you are welcome





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

Proud to be a Super User!




ryan_mayu
Super User
Super User

@Anonymous 

you can try this

Column = 
VAR _date=date(left('Table'[hourofday],4),mid('Table'[hourofday],5,2),mid('Table'[hourofday],7,2))
VAR _time=time(right('Table'[hourofday],2),0,0)
return _date+_time

1.PNG





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

Proud to be a Super User!




Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.