Forum Discussion

robertoz's avatar
robertoz
Advocate I
10 years ago

Date.EndOfYear(DateTime.LocalNow())

Dear all,

 

why Date.EndOfYear(DateTime.LocalNow()) PowerQuery is showing "rounded" date "1.1.2017 0:00:00" (Data Type = Date/Time)

Expected result shown should be "31.12.2016 23:59:59"

I understand, that behind "1.1.2017 0:00:00" in "31.12.2016 23:59:59,999..." but without knowing what is behind it can be confusing

 

thx.

Robert

2 Replies

  • KGrice's avatar
    KGrice
    Memorable Member

    Are you using this in a calculation or something? I can't get the same result; I actually get what I would expect:

     

     

     

    Maybe it's handled differently in different versions? I'm a month behind the most recent version.

    • robertoz's avatar
      robertoz
      Advocate I

      Hi,

      Thanks.

      Yes, i discovered it by using in calculation - I add a new column =  Date.EndOfYear(DateTime.LocalNow()). Different formats are showing it different:

      If Date/Time OR Any is used then : 

      1.1.2017 0:00:00

       

      If Time OR Text format used then 

      31.12.2016

       

      your result is the result of the query - single value.

       

      IT does not influence the calculation itself. It is "rounding" the date when shoving values in Column.

      R.