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 per my timezone..
Can anyone help if i have to amend the formula?
 
Thanks

3 Replies

  • edhans's avatar
    edhans
    Community Champion

    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

      • edhans's avatar
        edhans
        Community Champion

        Glad I could help Anonymous !