Forum Discussion

dsabsi's avatar
dsabsi
Advocate I
9 years ago
Solved

How to convert text (data type) to a date (data type)?

Hello guys,    I need your help with converting a text column towards a data type.  Should i add a column with a certain formula to achieve this?    See below the error that I'm getting from thi...
  • MarcelBeug's avatar
    MarcelBeug
    9 years ago

    Sure (I included some Dutch as well :-) ):

     

    let
        Source = #table(type table[Verwachte_Start = text],{{"1499032800"},{"1498860000"},{"1493589600"},{"1491170400"}}),
        AddedUTCDateTime = Table.AddColumn(Source, "Verwachte_startdatum/tijd_UTC", each #datetimezone(1970,1,1,0,0,0,0,0) + #duration(0,0,0,Number.From([Verwachte_Start])), type datetimezone),
        AddedLocalDate = Table.AddColumn(AddedUTCDateTime, "Verwachte_startdatum_lokaal", each Date.From([#"Verwachte_startdatum/tijd_UTC"]), type date)
    in
        AddedLocalDate