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
SivaMani How do you know that the culture code should be "en-GB", without any information from dsabsi how his dates look like?
Just to give an impression: below some date formats for April 1, 2017, and the number of culture codes using that format:
MarcelBeug In my experience, Power BI's default date format is MM/DD/YYYY - Because of Locale(by default) in English(United State).
GB's date format is DD/MM/YYYY.
According to your sample date formats,
4th (2017-04-01) and 6th(4/1/2017) formats will be detected as a date by Power BI.
The Rest of them, we have to convert it to the required format. Since it is in English(GB) format. So I have used "en-GB"
I hope I've made it clear enough.
If you have anything apart from this, just tell me it will be helpful.
Thanks,
Siva
- MarcelBeug9 years agoCommunity Champion
The default depends on your Regional Settings in Windows when you create a new Power BI Desktop file.
Again: we didn't get any information how the dates look like, so we just don't know and can only guess.
Just to give you an idea: there are almost 600 different culture codes, that may influence formats (dates, numbers, of course names of days and months) and even the A-Z sort order, e.g. Hawaii puts the vowels up front:
Otherwise of course not all cultures use the characters A-Z as their alphabet.
- SivaMani9 years agoResident Rockstar
MarcelBeug Thank you so much for your valuable information.