The transition to NetApp MS Azure AD B2C is complete. If you missed the pre-registration, you will be invited to reigister at next log in.
Please note that access to your NetApp data may take up to 1 hour.
To learn more, read the FAQ and watch the video.
Need assistance? Complete this form and select “Registration Issue” as the Feedback Category.

Microsoft Virtualization Discussions

Get-NaSnapshot AccessTimeDT property Kind is set to local

bsti

I've noticed a strange issue in the latest versions of the Powershell ONTAP toolkit.  When I return the AccessTimeDT of a snapshot using Get-NaSnapshot, the Kind property of the DateTime property is set to local.  I can confirm in older versions (1.7 to be precise), it would return the default value of unspecified (which assumes UTC).

What this is doing is causing the .ToLocalTime() method to NOT work on AccessTimeDT.  For instance, I'm located in UTC -4 (EST) time zone.  Basically, I can only return UTC times.

For example:  When I get  the AccessTimeDT property of snapshots, they are shown in the UTC time zone.  A snapshot shows an AccessTimeDT of 11/1/2012 4:00 PM.  In my time, it's actually 11/1/2012 12:00 PM.  In past versions, if I call:

$snapshot.AccessTimeDT 

#  Displays 11/1/2012 4:00 PM

$snapshot.AccessTimeDT.ToLocalTime() 

#  Displays 11/1/2012 12:00 PM

$snapshot.AccessTimeDT.Kind

#  Displays "unspecified"

SInce Upgrading to version 2.2, I get the following results:

$snapshot.AccessTimeDT 

#  Displays 11/1/2012 4:00 PM

$snapshot.AccessTimeDT.ToLocalTime() 

#  Displays 11/1/2012 4:00 PM

$snapshot.AccessTimeDT.Kind

#  Displays "local"

There is something different going on in the handling of the DateTime objects for snapshots.  Are you specifically setting the Kind property to "local" for some reason? 

I've verified t his works in 1.7, but not in versions 2.1 and on.  I don't have version 2.0 to test with.


Thanks!

1 ACCEPTED SOLUTION

beam

Thanks for bringing this to our attention.  We'll look into what caused this change.  In the meantime, you can construct a new DateTime object with an unspecified kind using New-Object DateTime @($snapshot.AccessTimeDT.Ticks).

Thanks,

Steven

View solution in original post

8 REPLIES 8

beam

Thanks for bringing this to our attention.  We'll look into what caused this change.  In the meantime, you can construct a new DateTime object with an unspecified kind using New-Object DateTime @($snapshot.AccessTimeDT.Ticks).

Thanks,

Steven

View solution in original post

wippel

Please tell me, how to handle snapshots created in daylight saving time!

bsti

I see two options:

1)  Go to version 1.7 or before.

2)  Use this instead:

([DateTime]($snapshot.AccessTimeDT.Ticks)).ToLocalTime()

wippel

Thanks, that works localy, how does it work for remotely managed NetApps of other timezones?

bsti

I think you'd need to omit the ToLocalTime() method call so it returns UTC if you are querying controllers outside your timezone.

wippel

Yes, but for example, Pacific Standard Time (PST) becomes Pacific Daylight Time (PDT)!

bsti

If you are working with UTC I'm not sure how that matters.  I may be missing the scenario you are describing...

bsti

Thanks for the suggestion!  I look foward to a resolution.

Announcements
NetApp on Discord Image

We're on Discord, are you?

Live Chat, Watch Parties, and More!

Explore Banner

Meet Explore, NetApp’s digital sales platform

Engage digitally throughout the sales process, from product discovery to configuration, and handle all your post-purchase needs.

NetApp Insights to Action
I2A Banner
Public