Forum Discussion
UncleLewis
4 years agoResponsive Resident
Get Date As Text
Hi all, How can I get Date from DateTime field as Text in format "YYYYMMDD"? I tried Date.ToText([mydate],[Format = "YYYYMMDD"]) Buget getting error: Parameter Error: We couldn't convert th...
- Anonymous4 years ago
Try this:
Date.ToText(Date.From([mydate]),[Format = "YYYYMMDD"])
--Nate
Anonymous
4 years agoNot applicable
My bad!
Text.Select(Date.ToText(Date.From([mydate]),[Format = "YYYYMMDD"]), {"0".."9"})
--Nate
UncleLewis
4 years agoResponsive Resident
Thanks Nate,
That works for YYYYMMDD, I'm trying to get to YYYYMMDD_HHMMSS
I change the format string to YYYYMMDD_HHMMSS
But that is returning a format error
Could a solution be to split the date, time into 2 different fields, convert each field to text, then concatenate each field to the id so the final PK is in the format id_YYYYMMDD_HHMMSS?
Thanks,
-w
- Anonymous4 years agoNot applicable
If it's a datetime field, just use DateTime.ToText, and remove the Date.From.
--Nate