Forum Discussion

rodriguise's avatar
rodriguise
Regular Visitor
9 years ago
Solved

RFC3339 Dates

Dates in my source are stored in RFC3339 "2006-01-02T15:04:05.000Z07:00". The DateValue function does not like this, how can I make use of date function in the platform?
  • MarcelBeug's avatar
    MarcelBeug
    9 years ago

    In Power Query, such dates can be converted to datetimezone format using formula

     

    DateTimeZone.From(Text.Replace([Input],"Z","+"))

    and changing the data type to date/time/timezone.

     

     

    The data model doesn't have datetimezone format: when the result from Power Query is loaded into the data model, the UTC Offset is just cut off. If the data type is left as "any" in Power Query, the result loads as text.

    Power Query has several functions to switch the UTC Offset and to convert datetimezone data to local date/time.

    In the picture below you can see the input and 3 columns with the result from the formula above (my culture code is set to "en-US"): as datetimezone, as any, as datetime (which converts the datetimezone to the local UTC Offset; in my case, on January 2, 2006 +01:00, so 6 hours behind UTC Offset +07:00 and 8 hours ahead of UTC Offset -07:00).