Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Custom Column with todays date - not working as expected

Hi Experts, I have created a custom column by adding the below formula to get today's date in the column. Date.From(DateTime.LocalNow())   But for some reason, I cannot get the Local date as...
  • edhans's avatar
    4 years ago

    Use Date.From(DateTimeZone.FixedLocalNow()) instead.
    You can force the TZ to a specific zone using:
    DateTimeZone.SwitchZone(DateTimeZone.LocalNow(), -7) (this is UTC -7 hrs)

    See this page for all of the ways you can work with timezones in PQ.

    DateTimeZone functions - PowerQuery M | Microsoft Docs