Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

convert string to datetime

Hi, I have a table like this :

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!

  • 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

3 Replies

  • 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