Forum Discussion
How to convert text (data type) to a date (data type)?
- 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
Hi Guys AnonymousSivaManiMarcelBeugblopez11,
I found out that the text value is an epoch value in a text value.
Do you know how to convert an epoch value in a text format to dates value in date format?
Cheers,
DSabsi
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- dsabsi9 years agoAdvocate I
Hi MarcelBeug,
Thank you for your answer (and of course in Dutch ;) I appreciate that.
Should I try your formula in a column or through edit-queries?
Cheers,
DSabsi
- MarcelBeug9 years agoCommunity Champion
My solutions are always (99.9%) via Edit Queries.
- dsabsi9 years agoAdvocate I
Hi MarcelBeug,
Thank you for your solution, you're great!
I also learned that an alternative to this is:
1. Convert the text to a number by the following formula (creat new column) : Verwachte start number = value([verwachte_start] )/(60*60*24)
2. Convert the value to a year date format (create new column) : Verwachte StartJaar = YEAR(IF([Verwachte start number] = BLANK() ;BLANK();DATEVALUE("01/01/1970") + [Verwachte start number]))
Cheers,
DSabsi